There's probably a "setup.exe" on half of the install CDROMs, so it's
not a very effective test to make sure the right media is in the tray...
Thanks for the clarification I misunderstood the operation of that function. I have corrected the script to use a more unique file as the check :)
Better stick to standard message "Please select the setup file to run." to avoid extra translation work (http://www.playonmac.com/en/dev-documentation-10.html).
I definitely would like to minimize any translation work, however I would like to specify that it is a Setup.exe that we are looking for, as there is a Start.exe, SetupMobile.exe, and autorun.exe all in the installation directory. Could I use the phrase: "Please select the setup file to run {Setup.exe}" instead?
To answer your last question, since PlayOnLinux/PlayOnMac 4.1.4, POL_SetupWindow_browse supports more parameters:
# Usage: POL_SetupWindow_browse [message] [title] [default value] [Supported file types]
Since
older versions will disregard the extra parameters and still work, no
version check should be necessary. And yes, it's undocumented
Thanks for that insight. I have added the additional filter to guarantee only exe files can be selected. Could I also use the following code:
DONE="FALSE"
while [ "$DONE" = "FALSE" ]
do
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run {Setup.exe}')" "$TITLE" "" "exe"
# Verify a the Setup.exe was selected and not another .exe on the CD
if [ ${APP_ANSWER:(-9)} = "Setup.exe" ]
then
DONE="TRUE"
else
POL_SetupWindow_message "$(eval_gettext 'Setup.exe was not selected, Please select the setup file to run {Setup.exe}')" "$(eval_gettext 'File Selection Error')"
fi
done
POL_Wine start /unix "$APP_ANSWER"
This verifies that a Setup.exe was selected (not perfect as it could be the wrong Setup.exe) but closer.
If this is acceptable then here is my corrected script:
#!/bin/bash
# Date : 2014-01-25 13-47
# Last revision : 2014-01-25 13-47
# Wine version used : 1.7.11
# Distribution used to test : MAC OSX 10.9.1
# Author : William Blake
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
# Variable
TITLE="Watchtower Library"
PUBLISHER="Watchtower Bible and Tract Society of PA"
PREFIX="Watchtower"
URL="http://www.jw.org"
AUTHOR="William Blake"
DONE="FALSE"
# Initialization
POL_SetupWindow_Init
POL_Debug_Init
# Presentation
POL_SetupWindow_presentation "$TITLE" "$PUBLISHER" "$URL" "$AUTHOR" "$PREFIX"
# Create Prefix
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
# Select Installation Method
POL_SetupWindow_InstallMethod "CD,LOCAL"
if [ "$INSTALL_METHOD" = "CD" ]
then
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "rs_data/PUBS"
POL_Wine start /unix "$CDROM/Setup.exe"
elif [ "$INSTALL_METHOD" = "LOCAL" ]
then
while [ "$DONE" = "FALSE" ]
do
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run {Setup.exe}')" "$TITLE" "" "exe"
# Verify a the Setup.exe was selected and not another .exe
if [ ${APP_ANSWER:(-9)} = "Setup.exe" ]
then
DONE="TRUE"
else
POL_SetupWindow_message "$(eval_gettext 'Setup.exe was not selected, Please select the setup file to run {Setup.exe}')" "$(eval_gettext 'File Selection Error')"
fi
done
POL_Wine start /unix "$APP_ANSWER"
fi
# Wait for Installation to Exit
POL_Wine_WaitExit
POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed')" "Installation in progress"
# Create Shortcuts
POL_Shortcut "wtlibrary.exe" "$TITLE"
# Remove .lnk created on the desktop by wine installation application
rm ~/Desktop/Watchtower*.lnk
# Close and Exit
POL_SetupWindow_Close
exit
Edité par wblake0000