Skip to content

Handle special characters in project paths in analyzeall.lua#89

Open
iamevn wants to merge 3 commits intopkulchenko:masterfrom
iamevn:patch-1
Open

Handle special characters in project paths in analyzeall.lua#89
iamevn wants to merge 3 commits intopkulchenko:masterfrom
iamevn:patch-1

Conversation

@iamevn
Copy link

@iamevn iamevn commented Feb 25, 2021

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.

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.
@pkulchenko
Copy link
Owner

pkulchenko commented Feb 25, 2021

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

@iamevn iamevn changed the title Handle windows paths in analyzeall.lua Handle Windows project paths in analyzeall.lua Feb 25, 2021
@iamevn
Copy link
Author

iamevn commented Feb 25, 2021

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

@pkulchenko
Copy link
Owner

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

@iamevn
Copy link
Author

iamevn commented Feb 25, 2021

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

@iamevn iamevn changed the title Handle Windows project paths in analyzeall.lua Handle special characters in project paths in analyzeall.lua Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants