fix: normalize win32 paths to use on glob expressions #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
While testing
cacache.verify
I found that on Windows thestats
returned by it are not properly reported. Moreover, I found thatcacache.verify
fails to delete files if no cache entries refer to them.cacache.rm.all
also fails to work on Windows: the cache is not cleared after calling this function.Why
The root of the problem is the same:
globify
function is not replacing to forward-slashes asglob
library is expecting to handle Windows paths.I found that originally
globify
was atlib/verify.js
, the replacement of the forward-slashes was made correctly.But when created the file
lib/util/glob.js
and movedglobify
there, it was changed towhich is causing problems when
glob
is used for obtaining stats and cleanup in the case ofverify
and delete the cache with rm.allChange details
Replace backslash by forward-slashes if they are present on a path before calling
glob
.Initially I was going to rollback the change to the first implementation of
globify
, but I though it would be more explicit to use path.sep.Issues reported
[BUG] rm.all doesn't delete anything on Windows #165