Skip to content

Commit

Permalink
Fixes to fix regression introduced by the new cache system changes
Browse files Browse the repository at this point in the history
- Ensure parent folders exists before writing `project_cracked.json`
- Ensure `fable_modules` folder exists before deleting it, instead of relying on a silent exception
  • Loading branch information
Maxime Mangel committed Aug 18, 2023
1 parent d212c2f commit 9aaa9cb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Fable.Cli/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ type CacheInfo =

member this.Write() =
let path = CacheInfo.GetPath(this.FableModulesDir, this.FableOptions.DebugMode)

// Ensure the destination folder exists
if not (IO.File.Exists path) then
IO.Directory.CreateDirectory(IO.Path.GetDirectoryName path) |> ignore

Json.write path this

/// Checks if there's also cache info for the alternate build mode (Debug/Release) and whether is more recent
Expand Down Expand Up @@ -106,9 +111,8 @@ type CrackerOptions(cliArgs: CliArgs) =
|> CrackerOptions.GetFableModulesFromDir

if noCache then
try
if IO.Directory.Exists(fableModulesDir) then
IO.Directory.Delete(fableModulesDir, recursive=true)
with _ -> ()

if File.isDirectoryEmpty fableModulesDir then
IO.Directory.CreateDirectory(fableModulesDir) |> ignore
Expand Down

0 comments on commit 9aaa9cb

Please sign in to comment.