#!/bin/sh
# File: /usr/bin/irfanview32
# Locations: symlink /usr/bin/irfanview
# Author: bgstack15@gmail.com
# Startdate: 2016-01-29
# Title: Wrapper script for passing files to Irfanview # Purpose: Converts file paths to a wine format and also handles compressed files
# History: 2016-01-29 Initial quick script written. It used a bunch of sed commands to transform paths to a wine format.
#    2019-02-26 remove /etc/default/irfanview file
#    2019-06-01 fix invocation for single item with space in name. Cannot call multiple objcts with spaces in filename.
#    2019-06-16 remove DEVTTY in favor of just showing on current tty
#    2019-06-16 replace winepath call with wine winepath.exe
#    2019-06-16 split into package-arch-specific and common scripts
# Usage: irfanview /path/to/image /another/image/file
# Reference:
#    Ideas for zip expansion and winepath https://github.com/Zykr/IrfanViewLinux/blob/master/irfanview
# Improve:

# load variables
test -z "${IV_WINEPREFIX}" && export IV_WINEPREFIX="$HOME/.wine"
test -n "${IV_WINEPREFIX}" && export WINEPREFIX="${IV_WINEPREFIX}" || export WINEPREFIX=$HOME/.wine
test -z "${IV_EXEC_NAME}" && export IV_EXEC_NAME="i_view32.exe"
test -z "${IV_EXEC_PATH}" && export IV_EXEC_PATH="/usr/share/irfanview32/i_view32.exe"
export IV_VALID_CALL=do_not_set_this_manually

. irfanview-common "$@"