Properly escape parenthesis
vredesbyyrd opened this issue · 3 comments
Not sure if this is fixable, but thought I should make the issue known. In order to 'cd' into a directory with parenthesis, they need to be escaped. This is how a path with () is currently copied:
/Music/Albums/Wolfmother/WOLFMOTHER\ Wolfmother\ (PBTHAL\ vinyl)
When it should be...
/Music/Albums/Wolfmother/WOLFMOTHER\ Wolfmother\ \(PBTHAL\ vinyl\)
In short, each parenthesis requires a backslash in front of it.
Thanks again for your work.
So I am in middle of re-tagging a bunch of music which requires copying messy paths into the terminal...so I made the addition myself. I do not know python, there is likely a more efficient way to do this.
Modified line 31 from:
return path.replace(' ', '\\ ')
to
return path.replace(' ', '\\ ').replace('(', '\(').replace(')', '\)')
Not sure if you want to go down the rabbit hole of escaping more characters than just spaces. Just stating that I have a solution for my current use case.
EDIT:
After tagging some more tunes with the help of your extension, I do not think there are any additional characters that need escaping. With the above parenthesis change to nautilus-copypath.py I have not come by any troublesome paths, yet. Perhaps it would be worth merging this change, or one like it.
@vredesbyyrd Thank you so much for your time - fix looks excellent.
Can you open a Pull Request? I'll happily merge it.
Thank you so much for your time - fix looks excellent.
No problem. And good to know :) I will open a pull request when I get home tonight. Thanks!