aboutsummaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-31 21:34:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-31 21:34:29 -0400
commit1efe4f3332680be5ad9d5d496939d6757fbd2b0a (patch)
tree7701ad33fa3866bbfb25e3483e5ebce89d28a855 /Assistant
parentb9afb7785e84ba03cb44a9b6962dbd01feaa4aae (diff)
only use smart default on first run
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/WebApp/Configurators.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Assistant/WebApp/Configurators.hs b/Assistant/WebApp/Configurators.hs
index 69108e46e..b9630b10a 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, "")