Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputFile split on non-regexable Windows File.Seperator #205

Open
talljhawkins opened this issue Nov 4, 2022 · 0 comments
Open

InputFile split on non-regexable Windows File.Seperator #205

talljhawkins opened this issue Nov 4, 2022 · 0 comments

Comments

@talljhawkins
Copy link

Hi,
I was getting a regex error on windows with an input file path of e.g. "c:\some path with a space\somemorepath\inputdirectoryname" in the method getInputPathSubDirsToCleanup

I looked at the code and guessed that it was because the use of the File.Separator being used as a regex. String.split() cannot cope with non escaped backslashes as the regex (which is what File.Separator is on Windows i.e. '').

From what I googled Pattern.quote() appears to be the right method to fix this...
e.g.
Original (line 225)
for (String subDirName : this.inputPathSubDir.split(File.separator)) {

Altered to :
for (String subDirName : this.inputPathSubDir.split( Pattern.quote( File.separator ) )) {

I have tested this code and it works on windows - but have no way of testing this on linux et al so did not want to commit (nor am I a committer etc)
Could someone who runs on linux test this fix and commit ?

thanks !
John.

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

No branches or pull requests

1 participant