FIX make xdg directories if they don't exist already (prompt needs this)

This commit is contained in:
Nathan Dwarshuis 2022-07-24 13:28:33 -04:00
parent 04e066e743
commit 0557d67d9e
2 changed files with 17 additions and 1 deletions

View File

@ -20,8 +20,10 @@ import Graphics.X11.Types
import Graphics.X11.Xlib.Atom import Graphics.X11.Xlib.Atom
import Graphics.X11.Xlib.Extras import Graphics.X11.Xlib.Extras
import System.Directory
import System.Environment import System.Environment
import System.IO import System.IO
import System.IO.Error
import System.Process import System.Process
import XMonad import XMonad
@ -75,11 +77,24 @@ run :: IO ()
run = do run = do
db <- connectDBusX db <- connectDBusX
conf <- withCache $ evalConf db conf <- withCache $ evalConf db
ds <- getDirectories ds <- getCreateDirectories
-- IDK why this is necessary; nothing prior to this will print if missing -- IDK why this is necessary; nothing prior to this will print if missing
hFlush stdout hFlush stdout
launch conf ds launch conf ds
getCreateDirectories :: IO Directories
getCreateDirectories = do
ds <- getDirectories
mapM_ (createIfMissing ds) [dataDir, cfgDir, cacheDir]
return ds
where
createIfMissing ds f = do
let d = f ds
r <- tryIOError $ createDirectoryIfMissing True d
case r of
(Left e) -> print e
_ -> return ()
data FeatureSet = FeatureSet data FeatureSet = FeatureSet
{ fsKeys :: ThreadState -> DBusState -> [KeyGroup FeatureX] { fsKeys :: ThreadState -> DBusState -> [KeyGroup FeatureX]
, fsDBusExporters :: [Maybe SesClient -> SometimesIO] , fsDBusExporters :: [Maybe SesClient -> SometimesIO]

View File

@ -71,6 +71,7 @@ executable xmonad
, xmonad >= 0.13 , xmonad >= 0.13
, xmonad-contrib >= 0.13 , xmonad-contrib >= 0.13
, lifted-base >= 0.2.3.12 , lifted-base >= 0.2.3.12
, directory >= 1.3.3.0
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -Werror -Wpartial-fields -fno-warn-missing-signatures -threaded ghc-options: -Wall -Werror -Wpartial-fields -fno-warn-missing-signatures -threaded