From 1efe4f3332680be5ad9d5d496939d6757fbd2b0a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 31 Jul 2012 21:34:29 -0400 Subject: [PATCH] only use smart default on first run --- Assistant/WebApp/Configurators.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assistant/WebApp/Configurators.hs b/Assistant/WebApp/Configurators.hs index 69108e46e2..b9630b10a5 100644 --- a/Assistant/WebApp/Configurators.hs +++ b/Assistant/WebApp/Configurators.hs @@ -96,15 +96,15 @@ checkRepositoryPath p = do expandTilde home ('~':path) = home path expandTilde _ path = path -{- If run in the home directory, default to putting it in ~/Desktop/annex, - - when a Desktop directory exists, and ~/annex otherwise. +{- On first run, if run in the home directory, default to putting it in + - ~/Desktop/annex, when a Desktop directory exists, and ~/annex otherwise. - - If run in another directory, the user probably wants to put it there. -} -defaultRepositoryPath :: IO FilePath -defaultRepositoryPath = do +defaultRepositoryPath :: Bool -> IO FilePath +defaultRepositoryPath firstrun = do cwd <- liftIO $ getCurrentDirectory home <- myHomeDir - if home == cwd + if home == cwd && firstRun then ifM (doesDirectoryExist $ home "Desktop") (return "~/Desktop/annex", return "~/annex") else return cwd @@ -112,7 +112,7 @@ defaultRepositoryPath = do addRepositoryForm :: Form RepositoryPath addRepositoryForm msg = do path <- T.pack . addTrailingPathSeparator - <$> liftIO defaultRepositoryPath + <$> liftIO defaultRepositoryPath =<< lift inFirstRun (pathRes, pathView) <- mreq (repositoryPathField True) ""(Just path) let (err, errmsg) = case pathRes of FormMissing -> (False, "")