summaryrefslogtreecommitdiff
path: root/irfanview/irfanview-common
diff options
context:
space:
mode:
Diffstat (limited to 'irfanview/irfanview-common')
-rwxr-xr-xirfanview/irfanview-common24
1 files changed, 14 insertions, 10 deletions
diff --git a/irfanview/irfanview-common b/irfanview/irfanview-common
index 6c178fc..9dcb4b0 100755
--- a/irfanview/irfanview-common
+++ b/irfanview/irfanview-common
@@ -11,6 +11,8 @@
# 2019-06-16 remove DEVTTY in favor of just showing on current tty
# 2019-06-16 replace winepath call with wine $WINEPATH_BIN
# 2019-06-16 split into package-arch-specific and common scripts
+# 2020-05-20 handle multiple filenames correctly now, including removing \r from winepath output
+# 2020-07-14 use echo binary instead of shell builtin
# Usage:
# called from irfanview (which is symlink to irfanview32 or ifanview64)
# Do not use this by itself.
@@ -24,7 +26,8 @@ then
false
else
-IV_VERSION="2019-06-16b"
+IV_VERSION="2020-07-14a"
+echobin="$( which echo )"
# Define functions
expandword() {
@@ -32,7 +35,7 @@ expandword() {
# if file, add it
# if directory, expand it
# if tarball, extract it and operate on the directory like normal
- local _word="$( echo "${@}" | sed -e 'sF\/\/F\/Fg;' )"
+ local _word="$( ${echobin} "${@}" | sed -e 'sF\/\/F\/Fg;' )"
if test -d "${_word}";
then
# loop through all files in the directory
@@ -47,22 +50,23 @@ expandword() {
*.tgz|*.tar.gz)
# extract it and expand the temporary directory
_tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}"
- echo "tmpdir ${_tmpdir}"
+ ${echobin} "tmpdir ${_tmpdir}"
tar -zx -C "${_tmpdir}" -f "${_word}"
expandword "${_tmpdir}"
;;
*.zip)
_tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}"
- echo "tmpdir ${_tmpdir}"
- echo "7za e -w${_tmpdir} ${_word}"
+ ${echobin} "tmpdir ${_tmpdir}"
+ ${echobin} "7za e -w${_tmpdir} ${_word}"
( cd "${_tmpdir}" ; 7za e "${_word}" ; )
expandword "${_tmpdir}"
;;
*)
# assume it is readable and add it to list of files to open
- echo "File ${_word}"
+ ${echobin} "File:1 ${_word}"
thisfile="$( getwinepath "${_word}" )"
- irfanfiles="${irfanfiles} ${thisfile}"
+ ${echobin} "File:2 ${thisfile}"
+ irfanfiles="${irfanfiles} '${thisfile}'"
;;
esac
fi
@@ -84,12 +88,12 @@ for word in "${@}";
do
expandword "${word}"
done
-irfanfiles="${irfanfiles## }"
+irfanfiles="$( ${echobin} "${irfanfiles## }" | sed -r -e 's/\r//g;' )"
# run wine
cd $WINEPREFIX
-printf wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles}
-wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles} &
+${echobin} wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles}
+eval wine \"${IV_EXEC_PATH}\" "${irfanargs}" "${irfanfiles}" &
wait %1
for thistempdir in ${alltempdirs};
bgstack15