More polish; pull terminal/finder windows to the front when stuff happens; include unzip progress in terminal

This commit is contained in:
Paul Chote
2010-07-07 22:27:30 +12:00
parent 4dd25d4936
commit bc016fd76d
3 changed files with 18 additions and 9 deletions

View File

@@ -54,6 +54,7 @@ fi
# Prompt for the mod to run
MODBUTTON=`/usr/bin/osascript << EOT
tell application "Finder"
activate
display dialog "Choose a mod" buttons {"Red Alert", "C&C", "Quit"} \
default button "Red Alert" \
with icon alias (POSIX file "$RESOURCES_PATH/OpenRA.icns") \

View File

@@ -26,6 +26,7 @@ RESOURCES_PATH=`pwd`/../Resources
`/usr/bin/osascript << EOT
tell application "Finder"
activate
display dialog "${2}\n\nSupport is available in our irc channel irc.freenode.net #openra." \
buttons "Quit" \
default button 1 \

View File

@@ -34,13 +34,24 @@ if [ ! -d "$SUPPORT_PATH" ]; then
fi
cd "$SUPPORT_PATH"
mkdir -p "${2}"
if [ -e "downloads/${1}" ]; then
mkdir -p "${2}"
unzip -o "downloads/${1}" -d "${2}"
/usr/bin/osascript << EOT
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
CONTINUE=`/usr/bin/osascript << EOT
tell application "Finder"
activate
display dialog "OpenRA needs to download ${4}.\n\nDownload size: ${3}" \
buttons {"Download", "Quit"} \
default button "Download" \
@@ -52,19 +63,15 @@ EOT`
exit 1
fi
mkdir -p "${2}"
/usr/bin/osascript << EOT
tell application "Terminal"
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
EOT
# Hack around osascript returning before the download finishes
while [ ! -e "downloads/done" ]; do
while [ ! -e "done" ]; do
sleep 1
done
rm "downloads/done"
unzip -o "downloads/${1}" -d "${2}"
rm "done"
fi