Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Detection and setting of HOME environment variable for Open/LibreOffice to use #101
When run, Unoconv now checks to see if the HOME environment variable is set and valid (i.e. exists and is writeable to). If neither of these things or if the user passes a '-H' argument, then Unoconv creates a temporary folder and sets that as HOME for the duration of the conversion, deleting it and its contents after use.
The user can also specify (with '--home=PATH') an alternate directory to use as HOME, and Unoconv will check that this is usable, defaulting to the user's HOME if not or a temporary folder if the user's HOME is not valid either.
As using a folder that has never been used before by Open/LibreOffice as HOME will cause Office to exit with code 81 (normal restart), Unoconv will catch this and try again. Unoconv will attempt to do this three times (four if you include the initial invocation) before giving up (to prevent an endless start-quit-start-quit cycle).
With any luck this should resolve issue #87. It certainly does for me.