Updated to work when run using Cygwin's python, with Cygwin-style paths as arguments.
Tested on Vista 32 bit, with latest Cygwin, native Windows LibreOffice 3.5.3 installed at 'C:\Program Files\LibreOffice 3.5' (/cygdrive/c/Program\ Files/LibreOffice\ 3.5), using Cygwin python 2.6.7 at /usr/bin/python. Also tested with native Windows python and on Linux to make sure the changes haven't broken anything there.
Cygwin support - works when run using Cygwin's python, with Cygwin st…
…yle paths as args.
Thanks for contributing the Cygwin support to unoconv. Before applying I need to know whether this cannot be improved/simplified. I don't like the fact that the paths need to be rewritten as it introduces a lot of code that impacts future options we might change. Is the Cygwin-style path support really needed ?
Converting sys.argv and UNO_PATH when launching the native python is essential, since the Cygwin python will have these as Cygwin style paths which the native python won't understand.
For the user-supplied args, I guess it's optional, since the user could do the same thing manually from the command line, by typing e.g. 'unoconv $(cygpath -w ~/test.odt)' instead of 'unoconv ~/test.odt', but they'll get file not found errors from LibreOffice if they forget to do the conversion (might not be obvious what the problem is). It seems natural to use Cygwin paths on Cygwin, and not supporting them puts the burden on the user to remember to convert, especially when it works seamlessly on the other platforms.
I suppose a cleaner way to do the conversion might be to reconstruct the args from the Options object rather than parsing argv again? Or you could just print a warning reminding users to manually convert the args when you detect Cygwin, and do away with the conversion code altogether.
Thanks for your PR.
Unfortunately it's can't be merge because of merge conflicts. I decided to close this PR for now.
But I'm really appreciate your willing help this project. Will be glad to merge it as soon as you can resolve conflicts. Cheers! 🍻