[commit: packages/directory] master: Allow a suffix to be specified in getXdgDirectory for convenience (eb3d0ff)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:50:28 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/eb3d0ff1ad06320e20d15eddbf8499e9e5abf0de/directory

>---------------------------------------------------------------

commit eb3d0ff1ad06320e20d15eddbf8499e9e5abf0de
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Mon Apr 27 03:38:22 2015 -0400

    Allow a suffix to be specified in getXdgDirectory for convenience


>---------------------------------------------------------------

eb3d0ff1ad06320e20d15eddbf8499e9e5abf0de
 System/Directory.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index 3e5f947..d24fd3b 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -1215,10 +1215,10 @@ data XdgDirectory
 --   to create it with file mode @700@ (i.e. only accessible by the owner).
 --
 --   /Since: 1.2.3.0/
-getXdgDirectory :: XdgDirectory -> IO FilePath
-getXdgDirectory xdgDir =
+getXdgDirectory :: XdgDirectory -> FilePath -> IO FilePath
+getXdgDirectory xdgDir suffix =
   modifyIOError (`ioeSetLocation` "getXdgDirectory") .
-  fmap normalise $
+  fmap (normalise . (</> suffix)) $
   case xdgDir of
     XdgData   -> get False "XDG_DATA_HOME"   ".local/share"
     XdgConfig -> get False "XDG_CONFIG_HOME" ".config"



More information about the ghc-commits mailing list