Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
AE-2042 Special handling to exec LibreOffice on Windows
Browse files Browse the repository at this point in the history
One difference on Windows is that the executable program is not
made available with the usual libreoffice name. This change makes
the backend just call it directly from its most common location.

Naive attempts at using the UserInstallation override resulted
in errors about a corrupted bootstrap.ini file. We do not absolutely
need to run multiple PDF generations in parallel, so the issue
is sidestepped by letting go of the mechanism needed for multiple
parallel executions.
  • Loading branch information
muep committed Dec 6, 2023
1 parent 1344e6f commit e4660c4
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions etp-backend/src/main/clj/solita/common/libreoffice.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@
"--headless"
args)))

(defn run-with-args [& args]
(let [tmpdir (make-tmpdir)]
(try
(populate-tmpdir tmpdir)
(exec-libreoffice tmpdir args)
(finally (rm-path tmpdir)))))
(defn exec-libreoffice-on-windows [args]
;; On windows, it seems to be difficult to get the UserInstallation parameter
;; to work at all. Because this is strictcly a development situation, we
;; ignore the usual need of having a per-process configuration. Instead, we
;; expect the developer to not run multiple PDF generaion operations
;; concurrently
(apply shell/sh "C:\\Program Files\\LibreOffice\\program\\soffice.bin" "--headless" args))

(defn run-with-args [& args]
(if (-> "os.name" System/getProperty (.startsWith "Windows "))
(exec-libreoffice-on-windows args)
(let [tmpdir (make-tmpdir)]
(try
(populate-tmpdir tmpdir)
(exec-libreoffice tmpdir args)
(finally (println (str 'rm-path tmpdir)))))))

0 comments on commit e4660c4

Please sign in to comment.