ZeroBranePackage
ZeroBranePackage copied to clipboard
Handle special characters in project paths in analyzeall.lua
I was having issues getting the ignore list working on Windows.
Figured out it had to do with gsub expecting a pattern instead of a literal string and the \\
characters in windows paths probably tripping it up.
filePath:gsub(projectPath, "")
would not find any matches and checkPath
would contain the full path to the file instead of a path rooted at the projectPath. Using a pattern similar to the masks gets the gsub working.
@iamevn, thank you for the patch! Do you have a specific example it was previously failing on?
Huh, was having trouble reproducing initially and it actually seems to be some problem with "-" in the project path?
Here's a gist with both the current checkPath
and the one from this patch and some extra prints and some of the output from it:
https://gist.github.com/iamevn/c29bdd6b687571a6146fc56bd1c66501
It may be related to the fact that -
is a special character and may need to be escaped (along with some other ones that may appear in paths).
Looking over this again I think the :gsub("%*", ".*")
part of path2mask
would be wrong to use on the projectPath
.