Created
December 22, 2012 18:58
-
-
Save uriel1998/4360493 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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