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 17:37:38 +0100
commit63fb0bfc26f42ba66c353e915e6e8219be679d07 (patch)
tree8970b2afa85cdc65e6995c5f0d360a62a1176479
parent0d14a9caaa9f3fee06c55f9e10acf6ce46b3389d (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 3c0545a..2079092 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -52,7 +52,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