Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Mac: keep the old app in a .noindex folder during an update so Spotlight and Launchpad never...

Bowen Xueb1983f96ae87
diff --git a/freevideo_engine/mac_app_update.py b/freevideo_engine/mac_app_update.py
index 97660ae..28d7b3b 100644
--- a/freevideo_engine/mac_app_update.py
+++ b/freevideo_engine/mac_app_update.py
@@ -14,7 +14,8 @@ import time
MARK = '.FreeVideo-update-'
-BACKUP = '.FreeVideo-backup-'
+BACKUP = '.FreeVideo-backup-' # the name older versions used, still cleaned up
+BACKUPS = '.FreeVideo-backup.noindex' # Spotlight and Launchpad skip folders ending in .noindex
MARGIN_BYTES = 256 * 2**20
HDIUTIL, DITTO, CODESIGN, XATTR = '/usr/bin/hdiutil', '/usr/bin/ditto', '/usr/bin/codesign', '/usr/bin/xattr'
@@ -32,11 +33,12 @@ done
restore() {
rm -rf "$app"
if [ -d "$backup" ]; then /bin/mv "$backup" "$app"; fi
+ rmdir "$(dirname "$backup")" "$(dirname "$(dirname "$backup")")" 2>/dev/null
rm -rf "$staged"
"$opener" "$app"
}
[ "$inject" = "before_backup" ] && { note "injected failure"; rm -rf "$staged"; "$opener" "$app"; exit 1; }
-if ! /bin/mv "$app" "$backup"; then note "could not set the old app aside"; rm -rf "$staged"; "$opener" "$app"; exit 1; fi
+if ! { /bin/mkdir -p "$(dirname "$backup")" && /bin/mv "$app" "$backup"; }; then note "could not set the old app aside"; rm -rf "$staged"; "$opener" "$app"; exit 1; fi
if [ "$inject" = "after_backup" ] || ! /bin/mv "$staged" "$app"; then note "could not put the new app in place"; restore; exit 1; fi
if [ "$inject" = "after_swap" ] || ! "$opener" "$app"; then
note "the new app did not open"; /bin/mv "$app" "$staged" && restore; exit 1
@@ -101,12 +103,14 @@ def _size(path):
def clear_stale(app):
for entry in app.parent.glob(MARK + '*.app'):
shutil.rmtree(entry, ignore_errors=True)
+ settle(app)
def settle(app):
"""Remove the old versions kept beside a running app; called once it has run well."""
for entry in app.parent.glob(BACKUP + '*.app'):
shutil.rmtree(entry, ignore_errors=True)
+ shutil.rmtree(app.parent / BACKUPS, ignore_errors=True)
def prepare(dmg, app, directory, *, run=subprocess.run):
@@ -165,7 +169,7 @@ def activate(staged, app, directory, *, popen=subprocess.Popen, inject=''):
script = directory / 'swap-app.sh'
script.write_text(SWAP_SCRIPT, encoding='utf-8')
script.chmod(0o755)
- backup = app.parent / (BACKUP + '%d.app' % int(time.time()))
+ backup = app.parent / BACKUPS / str(int(time.time())) / app.name
failure = directory.parent / 'mac-update-failed.json'
failure.unlink(missing_ok=True)
with (directory.parent / 'mac-update.log').open('ab') as log: