From a4fe8365f3745033a307817e754f132357af47f7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 14 Oct 2012 15:19:34 -0400 Subject: nub the autostart file It's possible for the file to get duplicate lines in it, and if so, we want to ignore the dups. --- Command/Assistant.hs | 2 +- Command/WebApp.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Command') diff --git a/Command/Assistant.hs b/Command/Assistant.hs index 53f7e4baf..b039e2731 100644 --- a/Command/Assistant.hs +++ b/Command/Assistant.hs @@ -54,7 +54,7 @@ autoStart = do let nothing = error $ "Nothing listed in " ++ autostartfile ifM (doesFileExist autostartfile) ( do - dirs <- lines <$> readFile autostartfile + dirs <- nub . lines <$> readFile autostartfile program <- readProgramFile when (null dirs) nothing forM_ dirs $ \d -> do diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 205e36341..f87ea983a 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -75,7 +75,7 @@ startNoRepo = do autoStart :: FilePath -> IO () autoStart autostartfile = do - dirs <- lines <$> readFile autostartfile + dirs <- nub . lines <$> readFile autostartfile edirs <- filterM doesDirectoryExist dirs case edirs of [] -> firstRun -- what else can I do? Nothing works.. -- cgit v1.2.3