2023-06-28 07:45:37 -04:00
|
|
|
#!/usr/bin/env osascript
|
|
|
|
|
|
|
|
|
2023-08-03 16:39:17 -04:00
|
|
|
set tmpPath to (POSIX path of "/tmp/")
|
|
|
|
set binPath to (tmpPath & "geode-install/")
|
2023-06-28 07:45:37 -04:00
|
|
|
|
2023-06-28 11:05:53 -04:00
|
|
|
on ExitWithMessage(message)
|
|
|
|
display dialog message
|
2023-08-03 16:39:17 -04:00
|
|
|
do shell script "sudo rm -rf \"" & binPath & "\""
|
2023-06-28 11:05:53 -04:00
|
|
|
error number -128
|
|
|
|
end ExitWithMessage
|
|
|
|
|
2023-06-28 07:45:37 -04:00
|
|
|
try
|
|
|
|
set gdPath to (the POSIX path of (choose file with prompt "Please choose the Geometry Dash application to install Geode to:" of type {"app"}))
|
|
|
|
on error
|
2023-06-28 11:05:53 -04:00
|
|
|
ExitWithMessage ("Prompt cancelled.")
|
2023-06-28 07:45:37 -04:00
|
|
|
end try
|
|
|
|
|
|
|
|
set execPath to (gdPath & "Contents/MacOS/Geometry Dash")
|
|
|
|
set frameworkPath to POSIX path of (gdPath & "Contents/Frameworks/")
|
|
|
|
set fmodPath to "libfmod.dylib"
|
2023-08-03 18:29:37 -04:00
|
|
|
set fmodOriginalPath to "restore_fmod.dylib"
|
2023-06-28 07:45:37 -04:00
|
|
|
set geodePath to "Geode.dylib"
|
|
|
|
set bootstrapperPath to "GeodeBootstrapper.dylib"
|
|
|
|
set resourcesPath to "resources/"
|
|
|
|
set newGeodePath to "Contents/geode/"
|
|
|
|
set newResourcesPath to (newGeodePath & "resources/geode.loader/")
|
|
|
|
|
2023-06-28 11:05:53 -04:00
|
|
|
try
|
|
|
|
tell application "System Events"
|
|
|
|
if not exists file execPath then
|
|
|
|
ExitWithMessage ("Not a valid Geometry Dash installation (executable missing): " & gdPath)
|
|
|
|
end if
|
|
|
|
|
|
|
|
if not exists file (frameworkPath & fmodPath) then
|
|
|
|
ExitWithMessage ("Not a valid Geometry Dash installation (fmod missing): " & gdPath)
|
|
|
|
end if
|
|
|
|
end tell
|
|
|
|
on error
|
|
|
|
ExitWithMessage ("Not a valid Geometry Dash installation: " & gdPath)
|
|
|
|
end try
|
|
|
|
|
|
|
|
try
|
2023-08-03 16:39:17 -04:00
|
|
|
do shell script "mv -n \"" & (frameworkPath & fmodPath) & "\" \"" & (frameworkPath & fmodOriginalPath) & "\""
|
2023-06-28 11:05:53 -04:00
|
|
|
on error
|
|
|
|
ExitWithMessage ("Moving original fmod failed: " & (frameworkPath & fmodPath))
|
|
|
|
end try
|
|
|
|
|
|
|
|
try
|
2023-08-03 16:39:17 -04:00
|
|
|
do shell script "sudo mv \"" & (binPath & geodePath) & "\" \"" & (frameworkPath & geodePath) & "\""
|
|
|
|
do shell script "sudo mv \"" & (binPath & bootstrapperPath) & "\" \"" & (frameworkPath & bootstrapperPath) & "\""
|
|
|
|
do shell script "sudo mv \"" & (binPath & fmodPath) & "\" \"" & (frameworkPath & fmodPath) & "\""
|
|
|
|
do shell script "INSTALLER_USER=$(stat -f '%Su' $HOME) && sudo chown -R $INSTALLER_USER \"" & frameworkPath & "\""
|
2023-06-28 11:05:53 -04:00
|
|
|
on error
|
|
|
|
ExitWithMessage ("Moving libraries failed: " & frameworkPath)
|
|
|
|
end try
|
|
|
|
|
|
|
|
try
|
2023-08-03 16:39:17 -04:00
|
|
|
do shell script "sudo mkdir -p \"" & (gdPath & newResourcesPath) & "\""
|
|
|
|
do shell script "sudo mv \"" & (binPath & resourcesPath) & "\"* \"" & (gdPath & newResourcesPath) & "\""
|
|
|
|
do shell script "INSTALLER_USER=$(stat -f '%Su' $HOME) && sudo chown -R $INSTALLER_USER \"" & (gdPath & newGeodePath) & "\""
|
2023-06-28 11:05:53 -04:00
|
|
|
on error
|
|
|
|
ExitWithMessage ("Moving resources failed: " & (gdPath & newResourcesPath))
|
|
|
|
end try
|
|
|
|
|
|
|
|
|
2023-08-03 16:39:17 -04:00
|
|
|
do shell script "sudo rm -rf \"" & binPath & "\""
|