From: David Lecompte <3gpp@metani.eu> Date: Wed, 3 Jun 2026 11:25:28 +0000 (+0200) Subject: Set libreoffice executable name for Cygwin and Linux X-Git-Url: https://nuage.metani.fr/gitweb/3GPP.git/commitdiff_plain/c48c5cf8fda5655f1b61706839d60602b34c5788 Set libreoffice executable name for Cygwin and Linux --- diff --git a/bin/docx2asn b/bin/docx2asn index 7618cb8..832f134 100755 --- a/bin/docx2asn +++ b/bin/docx2asn @@ -11,14 +11,24 @@ if [[ ! -w . ]] ; then exit 1 fi -if [[ ! -x $(which libreoffice) ]] ; then - echo "Cannot find executable libreoffice" +echo "platform est $platform" + +case $platform in + Linux) libreoffice="libreoffice" ;; + CYGWIN*) libreoffice="soffice" ;; + *) print "Unkown platform $platform" + exit 1;; +esac + +if [[ ! -x $(which "$libreoffice") ]] ; then + echo "Cannot find libreoffice executable" + echo "Make sure it is installed and the PATH variable includes its path" exit 1 fi while [ "$#" -gt 0 ]; do - echo "Processing parameter: $1" + echo "Processing $1" if [[ ! -f "$1" ]] || [[ ! -r "$1" ]] ; then echo "$1 is not a readable file" @@ -30,7 +40,7 @@ while [ "$#" -gt 0 ]; do echo "${1%.docx}.txt already exists: skipping conversion" else - libreoffice --convert-to txt "$1" + $libreoffice --convert-to txt "$1" if [[ ! -f "${1%.docx}.txt" ]] || [[ ! -r "${1%.docx}.txt" ]] ; then echo "libreoffice did not create ${1%.docx}.txt"