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 setup probes the install folder for links and renames

Bowen Xue06580fc15091
diff --git a/freevideo_engine/failure_details.py b/freevideo_engine/failure_details.py
index 7ce8926..86c3b7f 100644
--- a/freevideo_engine/failure_details.py
+++ b/freevideo_engine/failure_details.py
@@ -237,6 +237,12 @@ PLACE_RULES = (
'Choose a folder on an APFS or Mac OS Extended disk.',
'它不能安装 FreeVideo。'
'请选择其他硬盘上的文件夹。')),
+ (r'The installation folder is on a disk that does not support file links', 'disk-format',
+ ('This disk cannot hold the FreeVideo environment', '这块硬盘装不了 FreeVideo 的运行环境'),
+ ("It does not support the file operations that FreeVideo's Python environment needs. "
+ "Choose a folder on the Mac's built-in disk.",
+ '它不能安装 FreeVideo。'
+ '请选择 Mac 内置硬盘上的文件夹。')),
(r'The installation folder is on a disk that is not connected', 'disk-missing',
('The disk is not connected', '这块硬盘没有连接'),
('Connect the disk that holds the installation folder, then check again, or choose another folder.',
diff --git a/freevideo_engine/macos_bootstrap.py b/freevideo_engine/macos_bootstrap.py
index 2f1b0ef..2fb7f19 100644
--- a/freevideo_engine/macos_bootstrap.py
+++ b/freevideo_engine/macos_bootstrap.py
@@ -4,6 +4,7 @@ The caller supplies the shared installer's fetch/progress/cancellation service.
This prepares one tool; it does not declare a model installation ready.
"""
from pathlib import Path
+import errno
import json
import math
import os
@@ -38,6 +39,40 @@ def versions(value):
uv=dict(UV, url=UV['sources']['official']), github_probe_url=value['uv']['url'])
+LOCATION_UNSUPPORTED = 'The installation folder is on a disk that does not support file links'
+# What a volume answers when it lacks the operation, as opposed to a permission or space problem.
+UNSUPPORTED = (errno.ENOTSUP, errno.EOPNOTSUPP, errno.ENOSYS, errno.EPERM, errno.EXDEV, errno.EINVAL)
+
+
+def probe_links(root):
+ """'ok', 'copy' (no hard links) or 'blocked' (no symbolic links or renames) for a folder.
+
+ Any other failure, such as a missing permission, says nothing about the volume and counts as 'ok'."""
+ folder = Path(root) / ('.freevideo-link-probe-%d' % os.getpid())
+ try:
+ folder.mkdir(parents=True, exist_ok=True)
+ source = folder / 'source'
+ source.write_bytes(b'x')
+ result = 'ok'
+ for name, make in (('symlink', lambda: os.symlink(source.name, folder / 'symbolic')),
+ ('rename', lambda: os.rename(source, folder / 'renamed'))):
+ try:
+ make()
+ except OSError as error:
+ if error.errno in UNSUPPORTED:
+ return 'blocked'
+ return 'ok'
+ try:
+ os.link(folder / 'renamed', folder / 'hard')
+ except OSError as error:
+ result = 'copy' if error.errno in UNSUPPORTED else 'ok'
+ return result
+ except OSError:
+ return 'ok'
+ finally:
+ shutil.rmtree(folder, ignore_errors=True)
+
+
GIT_UNAVAILABLE = 'Git is unavailable. Check the network connection, or install Git (Apple Command Line Tools), then retry.'
diff --git a/freevideo_engine/macos_setup.py b/freevideo_engine/macos_setup.py
index cb01083..5f409ee 100644
--- a/freevideo_engine/macos_setup.py
+++ b/freevideo_engine/macos_setup.py
@@ -12,7 +12,13 @@ class Installer(SharedInstaller):
super().__init__(value, ui)
def device_environment(self, env):
- return native.environment(self.root, env)
+ env = native.environment(self.root, env)
+ links = native.probe_links(self.root)
+ if links == 'blocked':
+ raise RuntimeError(native.LOCATION_UNSUPPORTED)
+ if links == 'copy':
+ env['UV_LINK_MODE'] = 'copy'
+ return env
def device_configuration(self):
return dict(device_backend='mps', device_identity=self.plan['inventory']['selected_device'])