Revision: 16033
          http://sourceforge.net/p/skim-app/code/16033
Author:   hofman
Date:     2026-02-04 23:01:13 +0000 (Wed, 04 Feb 2026)
Log Message:
-----------
function in displayline script to expand paths

Modified Paths:
--------------
    trunk/displayline

Modified: trunk/displayline
===================================================================
--- trunk/displayline   2026-02-04 22:12:20 UTC (rev 16032)
+++ trunk/displayline   2026-02-04 23:01:13 UTC (rev 16033)
@@ -15,6 +15,15 @@
   exit 0
 fi
 
+# function to expand relative paths and escape double-quotes and backward 
slashes
+expand_path() {
+  f="$1"
+  [[  -z "${f}" || "${f:0:1}" == "/" ]] || f="${PWD}/${f}"
+  [[ "${f}" != *"\\"* ]] || f="${f//\\/\\\\}"
+  [[ "${f}" != *'"'* ]] || f="${f//\"/\\\"}"
+  echo "${f}"
+}
+
 # get arguments
 revert=
 reading_bar=
@@ -40,18 +49,10 @@
   shift
 done
 line=$1
-file="$2"
+file=$(expand_path "$2")
 shopt -s extglob
-[[ $# -gt 2 ]] && src="$3" || src=
+[[ $# -gt 2 ]] && src=$(expand_path "$3") || src=
 
-# expand relative paths and escape double-quotes and backward slashes
-[[ "${file:0:1}" == "/" ]] || file="${PWD}/${file}"
-[[ "${file}" != *"\\"* ]] || file="${file//\\/\\\}"
-[[ "${file}" != *'"'* ]] || file="${file//\"/\\\"}"
-[[ -z "${src}" || "${src:0:1}" == "/" ]] || src="${PWD}/${src}"
-[[ -z "${src}" || "${src}" != *"\\"* ]] || src="${src//\\/\\\\}"
-[[ -z "${src}" || "${src}" != *'"'* ]] || src="${src//\"/\\\"}"
-
 [[ -z "${src}" ]] || from_source="from POSIX file \"${src}\""
 
 [[ -z ${zerobased} ]] || (( line+=1 ))

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to