Skip to content

Commit

Permalink
feat: lake: use / in Windows manifest file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
tydeu committed Nov 2, 2023
1 parent 64561c0 commit 4a5b2b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/lake/Lake/Load/Manifest.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ inductive PackageEntryV6
(inputRev? : Option String) (subDir? : Option FilePath)
deriving FromJson, ToJson, Inhabited

/--
Use `/` and instead of `\\` in file paths
when serializing the manifest on Windows.
-/
local instance : ToJson FilePath where
toJson path :=
if System.Platform.isWindows then
Json.str <| path.toString.map fun c => if c = '\\' then '/' else c
else
Json.str path.toString

/-- An entry for a package stored in the manifest. -/
inductive PackageEntry
/--
Expand Down
2 changes: 0 additions & 2 deletions src/lake/tests/manifest/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ $LAKE resolve-deps
# Test update produces the expected V7 manifest
$LAKE update
sed_i "s/$REV/0538596b94a0510f55dc820cabd3bde41ad93c3e/g" lake-manifest.json
sed_i 's/\\\\/\//g' lake-manifest.json # normalize Windows paths
diff --strip-trailing-cr lake-manifest-v7.json lake-manifest.json

# Test successful loading of a V6 manifest
Expand All @@ -47,5 +46,4 @@ $LAKE resolve-deps
# Test update produces the expected V7 manifest
$LAKE update
sed_i "s/$REV/0538596b94a0510f55dc820cabd3bde41ad93c3e/g" lake-manifest.json
sed_i 's/\\\\/\//g' lake-manifest.json # normalize Windows paths
diff --strip-trailing-cr lake-manifest-v7.json lake-manifest.json

0 comments on commit 4a5b2b8

Please sign in to comment.