31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
|
From 237dc959ca536ae4a45d1ba59d4ad6cf86a36946 Mon Sep 17 00:00:00 2001
|
||
|
From: Ghostkeeper <rubend@tutanota.com>
|
||
|
Date: Mon, 25 Feb 2019 11:58:02 +0100
|
||
|
Subject: [PATCH] Fix install prefix when installing in symlinked directory
|
||
|
|
||
|
If /bin is a symlink to /usr/bin and /bin appears before /usr/bin on the user's PATH, it would get sys.argv[0]='/bin/python3'. This then messes up the install location ('/') which consequently messes up the data and config storage directories.
|
||
|
This solution is provided by CapnKernel and should resolve the symlink so that sys.argv[0]='/usr/bin/python3' again and the storage data and config storage directories become something like /usr/share/... again.
|
||
|
---
|
||
|
UM/Application.py | 5 +++--
|
||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git UM/Application.py UM/Application.py
|
||
|
index 05adb8f3..f709438a 100644
|
||
|
--- UM/Application.py
|
||
|
+++ UM/Application.py
|
||
|
@@ -398,9 +398,10 @@ class Application:
|
||
|
@staticmethod
|
||
|
def getInstallPrefix() -> str:
|
||
|
if "python" in os.path.basename(sys.executable):
|
||
|
- return os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
|
||
|
+ executable = sys.argv[0]
|
||
|
else:
|
||
|
- return os.path.abspath(os.path.join(os.path.dirname(sys.executable), ".."))
|
||
|
+ executable = sys.executable
|
||
|
+ return os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(executable)), ".."))
|
||
|
|
||
|
__instance = None # type: Application
|
||
|
|
||
|
--
|
||
|
2.21.0
|