ZeroBranePackage icon indicating copy to clipboard operation
ZeroBranePackage copied to clipboard

Handle special characters in project paths in analyzeall.lua

Open iamevn opened this issue 4 years ago • 4 comments

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 avatar Feb 25 '21 18:02 iamevn

@iamevn, thank you for the patch! Do you have a specific example it was previously failing on?

pkulchenko avatar Feb 25 '21 19:02 pkulchenko

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

iamevn avatar Feb 25 '21 20:02 iamevn

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).

pkulchenko avatar Feb 25 '21 20:02 pkulchenko

Looking over this again I think the :gsub("%*", ".*") part of path2mask would be wrong to use on the projectPath.

iamevn avatar Feb 25 '21 20:02 iamevn