Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mac builds #936

Merged
merged 8 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions UM/Application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2022 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

import platform
from pathlib import Path
import argparse
import os
Expand Down Expand Up @@ -177,12 +177,19 @@ def initialize(self) -> None:
Resources.ApplicationVersion = self._version

app_root = os.path.abspath(os.path.join(os.path.dirname(sys.executable)))
Resources.addSecureSearchPath(os.path.join(app_root, "share", "uranium", "resources"))

if platform.system() == "Darwin":
Resources.addSecureSearchPath(os.path.join(app_root, "Resources", "share", "uranium", "resources"))
else:
Resources.addSecureSearchPath(os.path.join(app_root, "share", "uranium", "resources"))

Resources.addSecureSearchPath(os.path.join(os.path.dirname(sys.executable), "resources"))
Resources.addSecureSearchPath(os.path.join(self._app_install_dir, "share", "uranium", "resources"))
Resources.addSecureSearchPath(os.path.join(self._app_install_dir, "Resources", "uranium", "resources"))
Resources.addSecureSearchPath(os.path.join(self._app_install_dir, "Resources", self._app_name, "resources"))

if platform.system() == "Darwin":
Resources.addSecureSearchPath(
os.path.join(self._app_install_dir, "Resources", "share", "uranium", "resources"))
else:
Resources.addSecureSearchPath(os.path.join(self._app_install_dir, "share", "uranium", "resources"))

if not hasattr(sys, "frozen"):
uranium_data_root = os.environ.get('URANIUM_DATA_ROOT', None)
Expand All @@ -196,7 +203,12 @@ def initialize(self) -> None:
Resources.addSearchPath(str(Path(__file__).parent.parent.parent.joinpath("plugins")))

# venv site-packages
Resources.addSearchPath(str(Path(sys.executable).parent.parent.joinpath("share", "uranium", "resources")))
if platform.system() == "Darwin":
Resources.addSearchPath(
str(Path(sys.executable).parent.parent.joinpath("Resources", "share", "uranium", "resources")))
else:
Resources.addSearchPath(
str(Path(sys.executable).parent.parent.joinpath("share", "uranium", "resources")))

i18nCatalog.setApplication(self)

Expand All @@ -221,6 +233,10 @@ def initialize(self) -> None:
self._plugin_registry.addPluginLocation(os.path.join(app_root, "share", "uranium", "plugins"))
self._plugin_registry.addPluginLocation(os.path.join(app_root, "share", "cura", "plugins"))

self._plugin_registry.addPluginLocation(
os.path.join(app_root, "..", "Resources", "share", "uranium", "plugins"))
self._plugin_registry.addPluginLocation(os.path.join(app_root, "..", "Resources", "share", "cura", "plugins"))

self._plugin_registry.addPluginLocation(os.path.join(self._app_install_dir, "lib", "uranium"))
self._plugin_registry.addPluginLocation(os.path.join(self._app_install_dir, "lib64", "uranium"))
self._plugin_registry.addPluginLocation(os.path.join(self._app_install_dir, "lib32", "uranium"))
Expand Down Expand Up @@ -499,7 +515,10 @@ def getAppFolderPrefix() -> str:
else:
executable = sys.executable
try:
return os.path.dirname(os.path.realpath(executable))
if platform.system() == "Darwin":
return os.path.join(os.path.dirname(os.path.realpath(executable)), "..", "Resources")
else:
return os.path.dirname(os.path.realpath(executable))
except EnvironmentError: # Symlinks can't be dereferenced.
return os.path.dirname(executable)

Expand Down
Loading