mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
Create config directory if it's missing (or repl history won't save).
This commit is contained in:
parent
fa3d9b76c8
commit
bcea722b84
@ -18,7 +18,7 @@ configPath :: FilePath -> IO FilePath
|
||||
configPath = xdgPath D.XdgConfig
|
||||
|
||||
createDirectoryIfMissing :: Bool -> FilePath -> IO ()
|
||||
createDirectoryIfMissing b = D.createDirectoryIfMissing b . toNative
|
||||
createDirectoryIfMissing createParents = D.createDirectoryIfMissing createParents . toNative
|
||||
|
||||
doesFileExist :: FilePath -> IO Bool
|
||||
doesFileExist = D.doesFileExist . toNative
|
||||
|
@ -69,6 +69,7 @@ completeKeywordsAnd words _ word = return $ findKeywords word (words ++ keywords
|
||||
readlineSettings :: Monad m => [String] -> IO (Settings m)
|
||||
readlineSettings words = do
|
||||
historyFile <- configPath "history"
|
||||
createDirectoryIfMissing True (takeDirectory historyFile)
|
||||
return $ Settings {
|
||||
complete = completeWordWithPrev Nothing ['(', ')', '[', ']', ' ', '\t', '\n'] (completeKeywordsAnd words),
|
||||
historyFile = Just historyFile,
|
||||
|
Loading…
Reference in New Issue
Block a user