Skip to content

Instantly share code, notes, and snippets.

@uriel1998 uriel1998/iview.sh

Created Dec 22, 2012
Embed
What would you like to do?
Example of how to pass a *nix (or OSX) file path to a windows program (run from WINE). Uses the example of IrfanView in a default installation on a default WINE install.
#!/bin/bash
#
# This is a bash script to properly pass a *nix or OS X path to a Windows program
# running under WINE.
#
# Written by Steven Saus (uriel1998)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-sa/3.0/.
#
# As usual, please change USER to your appropriate path. I am using the example
# of the AWESOME quick image handler IrfanView here: http://www.irfanview.com/
# which is installed to my main WINE directory. This script is made executable
# and placed in my path; if it's called with any parameters that are filenames
# it pulls up the file (or the first image in a directory if you pass a directory).
#
# Requires SED: https://www.gnu.org/software/sed/
#
# References:
# https://www.linuxquestions.org/questions/programming-9/replacing-slashes-with-back-slashes-escape-character-problem-854908/
# http://ubuntuforums.org/showthread.php?t=997166
export WINEPREFIX="/home/USER/.wine"
export WINEDEBUG="-all"
cd "/home/USER/.wine/drive_c/Program Files/IrfanView"
passfile=" "
if [ "$#" -gt "0" ]; then
if [ -a "$1" ]; then
passfile="$1"
fi
fi
if [ "$passfile" != " " ]; then
winpassfile=$(echo "$passfile" | sed -e 's@/@\\@g')
wine "/home/USER/.wine/drive_c/Program Files/IrfanView/i_view32.exe" "z:$winpassfile"
else
wine "/home/USER/.wine/drive_c/Program Files/IrfanView/i_view32.exe"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.