diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-01-17 19:53:26 -0800 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-01-17 21:03:25 -0800 |
| commit | 545c0911aa5d7d91280c5213c6d57b3e634ef1e5 (patch) | |
| tree | 253dafa60cd1247dc6161d13e29bfea5acbff359 /src | |
| parent | a92ae0a58a2b02d935b1e197f63d72bb8e61950b (diff) | |
T.P.App.Opt: fix logic bug in fullDefaultsPath.
Previously we would (also) search the default user data directory
for a defaults file, even if a different user data directory
was specified using `--data-dir`. This was a mistake; if
`--data-dir` is used, the default user data directory should
not be searched.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/App/Opt.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs index 4f5474c4f..2b3494022 100644 --- a/src/Text/Pandoc/App/Opt.hs +++ b/src/Text/Pandoc/App/Opt.hs @@ -707,9 +707,10 @@ fullDefaultsPath dataDir file = do let fp = if null (takeExtension file) then addExtension file "yaml" else file - defaultDataDir <- liftIO defaultUserDataDir - let defaultFp = fromMaybe defaultDataDir dataDir </> "defaults" </> fp - fromMaybe fp <$> findM fileExists [fp, defaultFp] + let searchpath = fp : case dataDir of + Nothing -> [] + Just d -> [d </> "defaults" </> fp] + fromMaybe fp <$> findM fileExists searchpath -- | In a list of lists, append another list in front of every list which -- starts with specific element. |
