diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-21 20:12:33 +0200 | 
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-06-21 20:12:33 +0200 | 
| commit | 1c94c1fe0a99fff34b491d0e275240f1b8c4e641 (patch) | |
| tree | 0e2bb084efe9a9b8f09e33a66d8fb2387fabc8ca | |
| parent | 11ddea05473a0afa9b736f3aca9351e3ac901bc0 (diff) | |
| download | trivmix-1c94c1fe0a99fff34b491d0e275240f1b8c4e641.tar trivmix-1c94c1fe0a99fff34b491d0e275240f1b8c4e641.tar.gz trivmix-1c94c1fe0a99fff34b491d0e275240f1b8c4e641.tar.bz2 trivmix-1c94c1fe0a99fff34b491d0e275240f1b8c4e641.tar.xz trivmix-1c94c1fe0a99fff34b491d0e275240f1b8c4e641.zip | |
Removed infinite loop caused by name colission
| -rw-r--r-- | adjmix/Adjmix.hs | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/adjmix/Adjmix.hs b/adjmix/Adjmix.hs index 49b820f..645ac6a 100644 --- a/adjmix/Adjmix.hs +++ b/adjmix/Adjmix.hs | |||
| @@ -19,6 +19,7 @@ optionParser = Options | |||
| 19 | <$> strOption ( long "base" | 19 | <$> strOption ( long "base" | 
| 20 | <> metavar "DIRECTORY" | 20 | <> metavar "DIRECTORY" | 
| 21 | <> value "/dev/shm/mix" | 21 | <> value "/dev/shm/mix" | 
| 22 | <> showDefault | ||
| 22 | ) | 23 | ) | 
| 23 | <*> strOption ( long "target" | 24 | <*> strOption ( long "target" | 
| 24 | <> short 't' | 25 | <> short 't' | 
| @@ -29,6 +30,7 @@ optionParser = Options | |||
| 29 | <> metavar "FILENAME" | 30 | <> metavar "FILENAME" | 
| 30 | <> value "level" | 31 | <> value "level" | 
| 31 | <> help "Filename of the level file" | 32 | <> help "Filename of the level file" | 
| 33 | <> showDefault | ||
| 32 | ) | 34 | ) | 
| 33 | <*> ( ( Set <$> option auto ( long "set" | 35 | <*> ( ( Set <$> option auto ( long "set" | 
| 34 | <> short 'o' | 36 | <> short 'o' | 
| @@ -58,12 +60,12 @@ main = execParser opts >>= adjmix | |||
| 58 | 60 | ||
| 59 | adjmix :: Options -> IO () | 61 | adjmix :: Options -> IO () | 
| 60 | adjmix Options{..} = do | 62 | adjmix Options{..} = do | 
| 61 | oldLevel <- readFile levelFile >>= readIO . stripSpace | 63 | oldLevel <- readFile levelFile' >>= readIO . stripSpace | 
| 62 | let | 64 | let | 
| 63 | newLevel = oldLevel `doAdjustment` adjustment | 65 | newLevel = oldLevel `doAdjustment` adjustment | 
| 64 | writeFile levelFile (show newLevel ++ "\n") | 66 | writeFile levelFile' (show newLevel ++ "\n") | 
| 65 | where | 67 | where | 
| 66 | levelFile = baseDirectory </> targetDirectory </> levelFile | 68 | levelFile' = baseDirectory </> targetDirectory </> levelFile | 
| 67 | stripSpace = reverse . stripSpace' . reverse . stripSpace' | 69 | stripSpace = reverse . stripSpace' . reverse . stripSpace' | 
| 68 | stripSpace' [] = [] | 70 | stripSpace' [] = [] | 
| 69 | stripSpace' l@(x:xs) = if isSpace x | 71 | stripSpace' l@(x:xs) = if isSpace x | 
