don't choke when database file doesn't exist
This commit is contained in:
parent
0adbc510ae
commit
82c53ce446
|
@ -43,6 +43,7 @@ import System.Console.HCL
|
||||||
, prompt
|
, prompt
|
||||||
, reqAgree
|
, reqAgree
|
||||||
, reqChar
|
, reqChar
|
||||||
|
, reqDefault
|
||||||
, reqIf
|
, reqIf
|
||||||
, reqIO
|
, reqIO
|
||||||
, reqMenu
|
, reqMenu
|
||||||
|
@ -94,7 +95,9 @@ confirm :: String -> Request Bool
|
||||||
confirm x = prompt (x ++ " (y/n): ") $ reqAgree Nothing $ fmap return reqChar
|
confirm x = prompt (x ++ " (y/n): ") $ reqAgree Nothing $ fmap return reqChar
|
||||||
|
|
||||||
loadFrom :: FilePath -> Request PWDatabase
|
loadFrom :: FilePath -> Request PWDatabase
|
||||||
loadFrom path = reqIO $ (decodeFileStrict path) >>= maybe
|
loadFrom path = reqDefault
|
||||||
|
(reqIO (decodeFileStrict path))
|
||||||
|
(Just newPWDatabase) >>= maybe
|
||||||
(return newPWDatabase)
|
(return newPWDatabase)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user