mirror of https://github.com/voidlizard/hbs2
fix hbs2-reposync for RO config
This commit is contained in:
parent
6d7616c426
commit
8d83317251
|
@ -19,8 +19,8 @@ import Data.Config.Suckless.Syntax
|
||||||
import Data.Config.Suckless.KeyValue
|
import Data.Config.Suckless.KeyValue
|
||||||
|
|
||||||
|
|
||||||
import Control.Monad.Catch
|
import Control.Monad.Catch (MonadThrow(..))
|
||||||
import Control.Monad.Except
|
import Control.Monad.Except (runExceptT,throwError)
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.ByteString.Lazy.Char8 qualified as LBS
|
import Data.ByteString.Lazy.Char8 qualified as LBS
|
||||||
import Data.Either
|
import Data.Either
|
||||||
|
@ -127,9 +127,8 @@ newState so refLog =
|
||||||
withConfig :: forall a m . (MonadUnliftIO m) => Maybe FilePath -> ReposyncM m a -> ReposyncM m ()
|
withConfig :: forall a m . (MonadUnliftIO m) => Maybe FilePath -> ReposyncM m a -> ReposyncM m ()
|
||||||
withConfig cfg m = do
|
withConfig cfg m = do
|
||||||
|
|
||||||
debug $ "wtf?"
|
|
||||||
|
|
||||||
let defDir = reposyncDefaultDir
|
let defDir = reposyncDefaultDir
|
||||||
|
|
||||||
defConfDir <- liftIO $ getXdgDirectory XdgConfig myName
|
defConfDir <- liftIO $ getXdgDirectory XdgConfig myName
|
||||||
|
|
||||||
realCfg <- case cfg of
|
realCfg <- case cfg of
|
||||||
|
@ -137,9 +136,9 @@ withConfig cfg m = do
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
liftIO do
|
liftIO do
|
||||||
let conf = defConfDir </> "config"
|
let conf = defConfDir </> "config"
|
||||||
createDirectoryIfMissing True defConfDir
|
void $ try @_ @IOException $ createDirectoryIfMissing True defConfDir
|
||||||
debug $ "config-dir" <+> pretty defConfDir
|
debug $ "config-dir" <+> pretty defConfDir
|
||||||
appendFile conf ""
|
void $ try @_ @IOException $ appendFile conf ""
|
||||||
pure conf
|
pure conf
|
||||||
|
|
||||||
syn <- liftIO (readFile realCfg) <&> parseTop
|
syn <- liftIO (readFile realCfg) <&> parseTop
|
||||||
|
|
Loading…
Reference in New Issue