gui_update.py: Work-around users manually moving app

Oversight from original update system, users were not expected to manually move the app to `/Applications`. This will ensure that there will always be a symlink instead
This commit is contained in:
Mykola Grymalyuk
2023-06-08 09:56:01 -06:00
parent 40160b644b
commit dccc39633b
3 changed files with 40 additions and 5 deletions

View File

@@ -227,18 +227,20 @@ if [ ! -d "/Library/Application Support/Dortania" ]; then
mkdir -p "/Library/Application Support/Dortania"
fi
# Check if '/Library/Application Support/Dortania/OpenCore-Patcher.app' exists
# Check if 'OpenCore-Patcher.app' exists
if [ -d "/Library/Application Support/Dortania/OpenCore-Patcher.app" ]; then
rm -rf "/Library/Application Support/Dortania/OpenCore-Patcher.app"
fi
if [ -d "/Applications/OpenCore-Patcher.app" ]; then
rm -rf "/Applications/OpenCore-Patcher.app"
fi
# Move '/tmp/OpenCore-Patcher.app' to '/Library/Application Support/Dortania'
mv "{str(self.application_path)}" "/Library/Application Support/Dortania/OpenCore-Patcher.app"
# Check if '/Applications/OpenCore-Patcher.app' exists
if [ ! -d "/Applications/OpenCore-Patcher.app" ]; then
ln -s "/Library/Application Support/Dortania/OpenCore-Patcher.app" "/Applications/OpenCore-Patcher.app"
fi
ln -s "/Library/Application Support/Dortania/OpenCore-Patcher.app" "/Applications/OpenCore-Patcher.app"
# Create update.plist with info about update
cat << EOF > "/Library/Application Support/Dortania/update.plist"