X.Prelude: Add mkAbsolutePath

This commit is contained in:
Tony Zorman
2022-05-17 08:33:18 +02:00
parent 473dc41afb
commit e466d9b1dc
3 changed files with 26 additions and 12 deletions

View File

@@ -57,7 +57,6 @@ import XMonad.Util.Parser
import XMonad.Util.XSelection (getSelection)
import Data.Time (Day (ModifiedJulianDay), NominalDiffTime, UTCTime (utctDay), addUTCTime, defaultTimeLocale, formatTime, fromGregorian, getCurrentTime, iso8601DateFormat, nominalDay, toGregorian)
import System.Directory (getHomeDirectory)
import System.IO (IOMode (AppendMode), hPutStrLn, withFile)
{- $usage
@@ -217,10 +216,7 @@ mkOrgPrompt xpc oc@OrgMode{ todoHeader, orgFile, clpSupport } =
else Body $ "\n " <> sel
-- Expand path if applicable
fp <- case orgFile of
'/' : _ -> pure orgFile
'~' : '/' : _ -> getHomeDirectory <&> (<> drop 1 orgFile)
_ -> getHomeDirectory <&> (<> ('/' : orgFile))
fp <- mkAbsolutePath orgFile
withFile fp AppendMode . flip hPutStrLn
<=< maybe (pure "") (ppNote clpStr todoHeader) . pInput