A suggestion to turn defaultUserDataDir :: IO FilePath into defaultUserDataDirs :: IO [FilePath]
Some checks failed
CI tests / linux (map[cabal:3.2 cabalopts: ghc:8.10.7 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.2 cabalopts: ghc:8.8.4 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.2 cabalopts:-f-embed_data_files ghc:8.6.5 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.4 cabalopts: ghc:9.0.2 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.6 cabalopts: ghc:9.2.3 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / windows (push) Has been cancelled
CI tests / macos (map[cabal:3.2 ghc:8.8.4]) (push) Has been cancelled
CI tests / benchmark (map[cabal:3.2 ghc:8.10.7]) (push) Has been cancelled
CI tests / benchmark (map[cabal:3.6 ghc:9.2.2]) (push) Has been cancelled
commit-validation / check-commit-msg-length (push) Has been cancelled
Some checks failed
CI tests / linux (map[cabal:3.2 cabalopts: ghc:8.10.7 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.2 cabalopts: ghc:8.8.4 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.2 cabalopts:-f-embed_data_files ghc:8.6.5 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.4 cabalopts: ghc:9.0.2 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / linux (map[cabal:3.6 cabalopts: ghc:9.2.3 testopts:--test-option=--hide-successes --test-option=--ansi-tricks=false]) (push) Has been cancelled
CI tests / windows (push) Has been cancelled
CI tests / macos (map[cabal:3.2 ghc:8.8.4]) (push) Has been cancelled
CI tests / benchmark (map[cabal:3.2 ghc:8.10.7]) (push) Has been cancelled
CI tests / benchmark (map[cabal:3.6 ghc:9.2.2]) (push) Has been cancelled
commit-validation / check-commit-msg-length (push) Has been cancelled
This commit is contained in:
parent
373423d537
commit
b84554880d
1 changed files with 8 additions and 6 deletions
|
@ -92,7 +92,7 @@ module Text.Pandoc.Shared (
|
|||
safeRead,
|
||||
safeStrRead,
|
||||
-- * User data directory
|
||||
defaultUserDataDir,
|
||||
defaultUserDataDirs,
|
||||
-- * Version
|
||||
pandocVersion
|
||||
) where
|
||||
|
@ -1017,13 +1017,15 @@ safeStrRead s = case reads s of
|
|||
-- is present, we return the XDG data directory. If the XDG data directory
|
||||
-- is not defined (e.g. because we are in an environment where $HOME is
|
||||
-- not defined), we return the empty string.
|
||||
defaultUserDataDir :: IO FilePath
|
||||
defaultUserDataDir = do
|
||||
defaultUserDataDirs :: IO [FilePath]
|
||||
defaultUserDataDirs = do
|
||||
xdgDir <- E.catch (getXdgDirectory XdgData "pandoc")
|
||||
(\(_ :: E.SomeException) -> return mempty)
|
||||
legacyDir <- getAppUserDataDirectory "pandoc"
|
||||
xdgExists <- doesDirectoryExist xdgDir
|
||||
legacyDirExists <- doesDirectoryExist legacyDir
|
||||
if not xdgExists && legacyDirExists
|
||||
then return legacyDir
|
||||
else return xdgDir
|
||||
let mainDir = if not xdgExists && legacyDirExists then legacyDir else xdgDir
|
||||
xdgDirs <- E.catch (getXdgDirectoryList XdgDataDirs)
|
||||
(\(_ :: E.SomeException) -> return mempty)
|
||||
return (mainDir:xdgDirs)
|
||||
|
||||
|
|
Loading…
Reference in a new issue