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