Normalize package paths to always contain a trailing slash#5178
Normalize package paths to always contain a trailing slash#5178fingolfin merged 2 commits intogap-system:masterfrom
Conversation
|
This seems fine to me in principle, but I'll be honest I've never used |
3246d8a to
199104c
Compare
Background: I use
Done! |
e64f523 to
f5fe757
Compare
| gap> IsPackageLoaded("mockpkg", ">=2.0"); | ||
| false | ||
|
|
||
| # now add `tst` as a new root directory |
There was a problem hiding this comment.
I'd rather not do this, nor add tst/pkg. Instead, we could create a temporary directory somewhere, then add a pkg subdir into it and into that a symlink to mockpkg.
There was a problem hiding this comment.
Two questions:
- Can we rely on
IO_symlinkin the test? If not, I guess things might get messy. - What about Windows, would
IO_symlinkwork there? Or can we somehow exclude this test on Windows?
There was a problem hiding this comment.
In simple terms, you can assume everything unixy will work in Windows. I'll be sure to double check any test, but I just tried and IO_symlink works fine.
There was a problem hiding this comment.
I would not rely on IO_symlink, which may not always be available (if IO is not compiled). You could simply use Exec("ln -sf FOO BAR"), or if you want to be able to detect errors, then use Process (and if anyone wants a nicer alternative, comment on #5103 ???)
There was a problem hiding this comment.
I have pushed a solution using Exec. If an error occurs, ValidatePackageInfo right after the Exec will fail saying that the file is not readable, so I think there is no need for an additional error check .
4588319 to
b2a4e4a
Compare
b2a4e4a to
443e1ae
Compare
SetPackagePathalways appends a trailing "/" to the installation path of a package whileAddPackageInfosdid not before this PR. This could lead to the following error:i.e. an error is signaled because the installation path differs by a trailing slash.
This PR does two things to prevent this:
AddPackageInfosto also include a trailing slash.Directoryin the comparison which triggers the error.Both changes would fix the error on their own, but I think both are sensible in general:
pkgpathis a user input, so normalizing it is a good idea anyway (as users might enter paths including "~" or with or without trailing slashes).Text for release notes
none