]> nuage.metani.fr Git - 3GPP.git/commitdiff
Set libreoffice executable name for Cygwin and Linux
authorDavid Lecompte <3gpp@metani.eu>
Wed, 3 Jun 2026 11:25:28 +0000 (13:25 +0200)
committerDavid Lecompte <3gpp@metani.eu>
Wed, 3 Jun 2026 11:25:28 +0000 (13:25 +0200)
bin/docx2asn

index 7618cb858a6a21fe6438308e2cd6b000a0a18d7c..832f1342570582972a56665fc5ca8e7617692fde 100755 (executable)
@@ -11,14 +11,24 @@ if [[ ! -w . ]] ; then
     exit 1
 fi
 
     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
 
     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"
 
     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
        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"
 
        if [[ ! -f "${1%.docx}.txt" ]] || [[ ! -r "${1%.docx}.txt" ]] ; then
            echo "libreoffice did not create ${1%.docx}.txt"