I made a Manifest.toml and Project.toml on Windows for a series of packages for a particular project, and I went to use them on a Unix environment (MacOS) and the manifest failed to work properly.
On Windows I did this:
(myproject) pkg> dev ./somepath/MyPackage.jl
And then on a Mac, I did this and got an error:
(myproject) pkg> resolve
Resolving package versions...
ERROR: path /path/to/myproject\somepath\MyPackage.jl for package MyPackage no longer exists. Remove the package or `develop` it at a new path
Opening the Manifest.toml and replacing all the instances of \\ with / fixed it, but it feels like this should be handled by Pkg for this case of making the toml files in windows and then opening it in a Unix location.
This appears very important. Seemingly, Linux and Windows developers cannot work on the same project without manually modifying .toml files. @StefanKarpinski, might this be addressed in the TOML parser? (https://github.com/wildart/TOML.jl/blob/master/src/parser.jl#L215).
In general Manifest.toml files that include path entries will not work on any other system though, but we can normalize the path for relative paths I guess.
I think this is enough actually:
diff --git a/src/manifest.jl b/src/manifest.jl
index 4a1619f..a06a33f 100644
--- a/src/manifest.jl
+++ b/src/manifest.jl
@@ -170,7 +170,11 @@ function destructure(manifest::Manifest)::Dict
entry!(new_entry, "version", entry.version)
entry!(new_entry, "git-tree-sha1", entry.repo.tree_sha)
entry!(new_entry, "pinned", entry.pinned; default=false)
- entry!(new_entry, "path", entry.path)
+ path = entry.path
+ if path !== nothing && Sys.iswindows() && !isabspath(path)
+ path = replace(path, "\\" => "/")
+ end
+ entry!(new_entry, "path", path)
entry!(new_entry, "repo-url", entry.repo.url)
entry!(new_entry, "repo-rev", entry.repo.rev)
if isempty(entry.deps)
I think something like this might be better:
join(splitpath(path), "/")
And then on the way back in do this:
joinpath(split(path, "/")...)
Yes, seems like the proper way to do it.
Most helpful comment
I think something like this might be better:
And then on the way back in do this: