col / qlcolorcode

Automatically exported from code.google.com/p/qlcolorcode
0 stars 0 forks source link

Problem processing certain quoted files #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
*** NOTE: Do not report errors in syntax highlighting unless they are for
the following languages: C, Objective-C, or OCaml.  Report highlighting
bugs in other languages to http://www.andre-simon.de/mail.html ***

What steps will reproduce the problem?
1. Rename/'touch' a text file with a single quote, like this: Roo'd.txt
2. It will not open with QLColorCode.

What is the expected output? What do you see instead?
I would have expected to see the contents (or just a blank screen, if just 
'touch'ed) of the file.
Problem is, that the quote (') (at least in bash) is a reserved word and thus 
the script falls over.
(OS X) Console.app barfs something like this:
QLColorCode: colorize.sh failed with exit code 2.  Command was 
('/Users/blah/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/color
ize.sh' 
'/Users/blah/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources' 
'/Users/blah/E-
Books/Klein, Joshua - Roo'd.txt' 0). 

I've looked into colorize.sh (which is a z.sh-script of which I have no idea) 
and it looks as if the 
file which is handed over as parameter is processed directly, thus the single 
quote being 
recognized as a special character and being treated as such - which it should 
not.

Manually calling colorize.sh with the appropriate parameters and "quoting" the 
filename like this 
Klein\,\ Joshua\ -\ Roo\'d\.txt
*does* work (to my surprise).

It looks - to me as a beginner - as if the incoming filename parameter needs to 
be quoted in 
"unix-style" fashion. Sounds probably easier than it really is. Maybe it's not 
possible at all.
I've though about something like this $(filename//'//\\'}, but of course, that 
would've been too 
easy.

Side remark: Yes, I know it's bad style to use single quotes in filenames, but 
unfortunately I have 
no say in what people do...

Side remark 2: The story I used as an example is actually existing. It's an 
interesting read, for 
free here: http://www.josh.is/projects/rood/

Side remark 3: Yes, I've read the instructions at the very beginning and am 
pretty sure, this 
should go to www.andre-simon.de, but then, I am not 100% sure where 
highlight.sh gets it's 
parameters from, so I gave it a shot here. Just say so, if I am wrong. Thanks 
in advance. :-)

Original issue reported on code.google.com by wolf.mce...@gmail.com on 6 Dec 2009 at 8:50