source: AE/Setup/Mac/Run AE Installer/Run AE Installer/AppDelegate.applescript@ 1042

Last change on this file since 1042 was 1042, checked in by iritscen, 9 years ago

Re-built Run AEI app for 10.12. No code changes.

File size: 4.9 KB
RevLine 
[1029]1-- Run AE Installer
2-- for Anniversary Edition Seven
3-- by Iritscen
4-- Serves as a forking alias which opens either the AE Installer, or, if the AEI is
5-- not found, the AEI Updater so it can install the Installer. Used as both a
6-- shortcut for the user and as a part of the AE Setup process.
7-- History:
[1042]8-- 1.0.9 - No code changes, but needed to re-build in 10.12 in order for it to work
9-- in 10.12.
[1030]10-- 1.0.8 - Now that Mono is installed in /usr/local/bin/ in 10.11, we need to add
11-- that path to PATH when invoking Java.
[1029]12-- 1.0.7 - Now an AppleScriptObjC application to ensure signing integrity and OS
13-- compatibility for 10.6 through 10.11.
14-- 1.0.6 - The previous method fails sometimes, e.g. in 10.7 with Apple Java
15-- installed, so now we are just looking in either place and calling Java
16-- when we find it.
17-- 1.0.5 - Removing "which java" as "smart" method for finding Java, as it can now
18-- return a value like "/usr/bin/java" even when Java is not really
19-- there; now calling Java using a fixed path for 10.6 and another fixed
20-- path for 10.7+.
21-- 1.0.4 - Calling Java through command-line again before falling back to Internet
22-- Plug-Ins location, to restore 10.6 compatibility.
23-- 1.0.3 - Instead of escaping only space characters in paths, put paths in quotes
24-- to avoid need for escaping entirely.
25-- 1.0.2 - Calling Java at Internet plug-in location instead of using basic command-
26-- line "java", as only the JDK installs command-line Java.
[1042]27-- 1.0.1 - Now setting environment to UTF-8 in order to avoid 'Ä' problem in Java 7.
[1029]28-- 1.0 - Initial release.
29
30script AppDelegate
31 property parent : class "NSObject"
32 global parentPathUnixNS
33 global parentPathUnixStr
34 global parentPathASAlias
35 global parentPathASStr
36
37 -- IBOutlets
38 property theWindow : missing value
39
40 on applicationWillFinishLaunching_(aNotification)
41 tell application "Finder"
42 tell current application's class "NSBundle"
43 tell its mainBundle()
44 set parentPathUnixNS to bundlePath()'s stringByDeletingLastPathComponent
45 set parentPathUnixStr to parentPathUnixNS as string
46 end tell
47 end tell
48 set parentPathASAlias to POSIX file parentPathUnixStr as alias
49 set parentPathASStr to parentPathASAlias as string
50 set success to true
51
52 -- Test for Java at the two standard locations
53 set javaPath to "/Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
54 set javaExistsTest to ("if [ -f " & javaPath & " ]; then echo okay; fi") as string
55 set javaExists to do shell script javaExistsTest without altering line endings
56 if (javaExists is "") then
57 -- Test for Java at old location (Apple Java)
58 set javaPath to "/usr/bin/java"
59 set javaExistsTest to ("if [ -f " & javaPath & " ]; then echo okay; fi") as string
60 set javaExists to do shell script javaExistsTest without altering line endings
61 if (javaExists is "") then
62 display alert "Could not find Java!"
63 set success to false
64 end if
65 end if
66
67 if (success is true) then
[1030]68 set run_prefix to "export PATH=/usr/local/bin:${PATH};export LC_CTYPE=\"UTF-8\";"
[1029]69 set AEIUfolder to parentPathASStr & "AEInstaller"
70 set AEIU to AEIUfolder & ":AEInstaller2Updater.jar"
71 set AEIU_CLI to POSIX path of AEIU
[1030]72 set run_AEIU to run_prefix & javaPath & " -jar \"" & AEIU_CLI & "\" &> /dev/null &"
[1029]73
74 set AEIfolder to parentPathASStr & "AEInstaller:bin"
75 set AEI to AEIfolder & ":AEInstaller2.jar"
76 set AEI_CLI to POSIX path of AEI
[1030]77 set run_AEI to run_prefix & javaPath & " -jar \"" & AEI_CLI & "\" &> /dev/null &"
[1029]78 if not (parentPathUnixNS's lastPathComponent as string is "AE") then
79 display alert "Please put \"Run AE Installer\" in the AE/ folder so I can find the Installer."
80 else if (AEI exists) then
81 do shell script run_AEI
82 else if (AEIU exists) then
83 do shell script run_AEIU
84 else
85 display alert "Could not find AE Installer *or* AE Installer Updater! You may need to re-install the AE."
86 end if
87 end if
88 end tell
89 tell me
90 quit
91 end tell
92 end applicationWillFinishLaunching_
93
94 on applicationShouldTerminate_(sender)
95 -- Insert code here to do any housekeeping before your application quits
96 return current application's NSTerminateNow
97 end applicationShouldTerminate_
98
99end script
Note: See TracBrowser for help on using the repository browser.