aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-01-31 09:32:18 -0800
committerJohn MacFarlane <[email protected]>2022-01-31 09:36:49 -0800
commit4c8c7f6dff865c8319253c808c0737848133f43b (patch)
treee1f0a71da54ae985156cbe525197e6732f28089b
parent46e593762890bf882a9941668699da867297649c (diff)
Revert "T.P.App.Opt: fix logic bug in fullDefaultsPath."
This reverts commit 545c0911aa5d7d91280c5213c6d57b3e634ef1e5. Fixes regression in 2.17.1. The original commit was completely misguided, and caused problems finding defaults files in the default user data directory.
-rw-r--r--src/Text/Pandoc/App/Opt.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index 2b3494022..4f5474c4f 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -707,10 +707,9 @@ fullDefaultsPath dataDir file = do
let fp = if null (takeExtension file)
then addExtension file "yaml"
else file
- let searchpath = fp : case dataDir of
- Nothing -> []
- Just d -> [d </> "defaults" </> fp]
- fromMaybe fp <$> findM fileExists searchpath
+ defaultDataDir <- liftIO defaultUserDataDir
+ let defaultFp = fromMaybe defaultDataDir dataDir </> "defaults" </> fp
+ fromMaybe fp <$> findM fileExists [fp, defaultFp]
-- | In a list of lists, append another list in front of every list which
-- starts with specific element.