diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2019-03-02 15:03:59 -0800 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-02 15:03:59 -0800 | 
| commit | 0bed0ab5a308f5e72a01fa9bee76488556288862 (patch) | |
| tree | 42b2e302ba259116557934166ca360e3e18bcccc /src/Text/Pandoc/App | |
| parent | a99423b59c78a1f64debad7340c5bbc0259e1215 (diff) | |
| download | pandoc-0bed0ab5a308f5e72a01fa9bee76488556288862.tar.gz | |
Use XDG data directory for user data directory.
Instead of `$HOME/.pandoc`, the default user data directory is
now `$XDG_DATA_HOME/pandoc`, where `XDG_DATA_HOME` defaults to
`$HOME/.local/share` but can be overridden by setting the environment
variable.
If this directory is missing, then `$HOME/.pandoc` is searched
instead, for backwards compatibility.  However, we recommend
moving local pandoc data files from `$HOME/.pandoc` to
`$HOME/.local/share/pandoc`.
On Windows the default user data directory remains the same.
Closes #3582.
Diffstat (limited to 'src/Text/Pandoc/App')
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 14 | 
1 files changed, 5 insertions, 9 deletions
| diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index 7f05418d9..36c68057c 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -46,15 +46,14 @@ import Text.Pandoc.App.Opt (Opt (..), LineEnding (..))  import Text.Pandoc.Filter (Filter (..))  import Text.Pandoc.Highlighting (highlightingStyles)  import Text.Pandoc.Writers.Math (defaultMathJaxURL, defaultKaTeXURL) -import Text.Pandoc.Shared (ordNub, safeRead) +import Text.Pandoc.Shared (ordNub, safeRead, defaultUserDataDirs)  import Text.Printf  #ifdef EMBED_DATA_FILES  import Text.Pandoc.Data (dataFiles) -import System.Directory (getAppUserDataDirectory)  #else  import Paths_pandoc (getDataDir) -import System.Directory (getAppUserDataDirectory, getDirectoryContents) +import System.Directory (getDirectoryContents)  #endif  import qualified Control.Exception as E @@ -837,13 +836,11 @@ options =                   (NoArg                    (\_ -> do                       prg <- getProgName -                     defaultDatadir <- E.catch -                            (getAppUserDataDirectory "pandoc") -                            (\e -> let _ = (e :: E.SomeException) -                                   in  return "") +                     defaultDatadirs <- defaultUserDataDirs                       UTF8.hPutStrLn stdout (prg ++ " " ++ pandocVersion ++                         compileInfo ++ "\nDefault user data directory: " ++ -                       defaultDatadir ++ copyrightMessage) +                       intercalate " or " defaultDatadirs ++ +                       ('\n':copyrightMessage))                       exitSuccess ))                   "" -- "Print version" @@ -872,7 +869,6 @@ usageMessage programName = usageInfo (programName ++ " [OPTIONS] [FILES]")  copyrightMessage :: String  copyrightMessage = intercalate "\n" [ -  "",    "Copyright (C) 2006-2019 John MacFarlane",    "Web:  http://pandoc.org",    "This is free software; see the source for copying conditions.", | 
