diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2017-12-26 13:54:48 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2017-12-26 13:54:48 +0100 |
commit | 336220ca9f3e1ab9091651d60a9491386f77b7ed (patch) | |
tree | 974dba6f3cd080ce8404a8738f9af757e70549c8 /lib | |
parent | 51631e2d2d5b6b83f84917f36477dd79c3457ea2 (diff) | |
download | stylish-haskell-336220ca9f3e1ab9091651d60a9491386f77b7ed.tar.gz |
Add platform specific configuration paths
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Language/Haskell/Stylish/Config.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Language/Haskell/Stylish/Config.hs b/lib/Language/Haskell/Stylish/Config.hs index 9fddbb5..8952790 100644 --- a/lib/Language/Haskell/Stylish/Config.hs +++ b/lib/Language/Haskell/Stylish/Config.hs @@ -73,12 +73,13 @@ defaultConfigFilePath = getDataFileName "data/stylish-haskell.yaml" configFilePath :: Verbose -> Maybe FilePath -> IO FilePath configFilePath _ (Just userSpecified) = return userSpecified configFilePath verbose Nothing = do - current <- getCurrentDirectory - home <- getHomeDirectory - def <- defaultConfigFilePath - mbConfig <- search $ + current <- getCurrentDirectory + configPath <- getXdgDirectory XdgConfig "stylish-haskell" + home <- getHomeDirectory + def <- defaultConfigFilePath + mbConfig <- search $ [d </> configFileName | d <- ancestors current] ++ - [home </> configFileName, def] + [configPath </> "config.yaml", home </> configFileName, def] case mbConfig of Just config -> return config |