set simRootDirectory on restore

It's a relative directory and the cwd may be different. Or the repo
could have been moved.
This commit is contained in:
Joey Hess 2024-09-20 15:11:55 -04:00
parent bab330de33
commit 31679e3e9f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -1089,13 +1089,14 @@ restoreSim rootdir =
Right c -> case readMaybe c :: Maybe (SimState ()) of
Nothing -> return (Left "unable to parse sim state file")
Just st -> do
let st' = st { simRootDirectory = fromRawFilePath rootdir }
repostate <- M.fromList
<$> mapM (thaw st) (M.toList (simRepoState st))
let st' = st
<$> mapM (thaw st') (M.toList (simRepoState st))
let st'' = st'
{ simRepoState =
M.map (finishthaw st') repostate
M.map (finishthaw st'') repostate
}
return (Right st')
return (Right st'')
where
thaw st (u, rst) = tryNonAsync (thaw' st u) >>= return . \case
Left _ -> (u, rst { simRepo = Nothing })