More polish; pull terminal/finder windows to the front when stuff happens; include unzip progress in terminal
This commit is contained in:
@@ -54,6 +54,7 @@ fi
|
|||||||
# Prompt for the mod to run
|
# Prompt for the mod to run
|
||||||
MODBUTTON=`/usr/bin/osascript << EOT
|
MODBUTTON=`/usr/bin/osascript << EOT
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
|
activate
|
||||||
display dialog "Choose a mod" buttons {"Red Alert", "C&C", "Quit"} \
|
display dialog "Choose a mod" buttons {"Red Alert", "C&C", "Quit"} \
|
||||||
default button "Red Alert" \
|
default button "Red Alert" \
|
||||||
with icon alias (POSIX file "$RESOURCES_PATH/OpenRA.icns") \
|
with icon alias (POSIX file "$RESOURCES_PATH/OpenRA.icns") \
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ RESOURCES_PATH=`pwd`/../Resources
|
|||||||
|
|
||||||
`/usr/bin/osascript << EOT
|
`/usr/bin/osascript << EOT
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
|
activate
|
||||||
display dialog "${2}\n\nSupport is available in our irc channel irc.freenode.net #openra." \
|
display dialog "${2}\n\nSupport is available in our irc channel irc.freenode.net #openra." \
|
||||||
buttons "Quit" \
|
buttons "Quit" \
|
||||||
default button 1 \
|
default button 1 \
|
||||||
|
|||||||
@@ -34,13 +34,24 @@ if [ ! -d "$SUPPORT_PATH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$SUPPORT_PATH"
|
cd "$SUPPORT_PATH"
|
||||||
|
mkdir -p "${2}"
|
||||||
|
|
||||||
if [ -e "downloads/${1}" ]; then
|
if [ -e "downloads/${1}" ]; then
|
||||||
mkdir -p "${2}"
|
/usr/bin/osascript << EOT
|
||||||
unzip -o "downloads/${1}" -d "${2}"
|
tell application "Terminal"
|
||||||
|
activate
|
||||||
|
do script "cd \"${SUPPORT_PATH}\"; unzip -o \"downloads/${1}\" -d \"${2}\"; touch done; exit;"
|
||||||
|
end tell
|
||||||
|
EOT
|
||||||
|
# Hack around osascript returning before the download finishes
|
||||||
|
while [ ! -e "done" ]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
rm "done"
|
||||||
else
|
else
|
||||||
CONTINUE=`/usr/bin/osascript << EOT
|
CONTINUE=`/usr/bin/osascript << EOT
|
||||||
tell application "Finder"
|
tell application "Finder"
|
||||||
|
activate
|
||||||
display dialog "OpenRA needs to download ${4}.\n\nDownload size: ${3}" \
|
display dialog "OpenRA needs to download ${4}.\n\nDownload size: ${3}" \
|
||||||
buttons {"Download", "Quit"} \
|
buttons {"Download", "Quit"} \
|
||||||
default button "Download" \
|
default button "Download" \
|
||||||
@@ -52,19 +63,15 @@ EOT`
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${2}"
|
|
||||||
|
|
||||||
/usr/bin/osascript << EOT
|
/usr/bin/osascript << EOT
|
||||||
tell application "Terminal"
|
tell application "Terminal"
|
||||||
activate
|
activate
|
||||||
do script "cd \"${SUPPORT_PATH}\"; curl --create-dirs -o \"./downloads/${1}\" \"${5}\"; touch \"downloads/done\"; exit;"
|
do script "cd \"${SUPPORT_PATH}\"; curl --create-dirs -o \"./downloads/${1}\" \"${5}\"; unzip -o \"downloads/${1}\" -d \"${2}\"; touch done; exit;"
|
||||||
end tell
|
end tell
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
# Hack around osascript returning before the download finishes
|
# Hack around osascript returning before the download finishes
|
||||||
while [ ! -e "downloads/done" ]; do
|
while [ ! -e "done" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
rm "downloads/done"
|
rm "done"
|
||||||
unzip -o "downloads/${1}" -d "${2}"
|
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user