summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-01-07 17:37:38 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2023-01-07 18:00:57 +0100
commit0c364245db08265992de49560977063bbb271163 (patch)
tree02d20abc44c4d5eb10199594df573cd6df31c89a
parent39cf8f9919ba953f4e782609562781daf3d13868 (diff)
Fix config lookup trying parents of root indefinitely
-rw-r--r--src/Config.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 7e9ad85..f9acac4 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -81,7 +81,10 @@ findConfig = go "."
doesFileExist (path </> name) >>= \case
True -> return $ Just $ path </> name
False -> doesDirectoryExist (path </> "..") >>= \case
- True -> go (path </> "..")
+ True -> do
+ parent <- canonicalizePath $ path </> ".."
+ if parent /= path then go parent
+ else return Nothing
False -> return Nothing
parseConfig :: FilePath -> IO Config