mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
chdir to ~ on Linux if frozen
This commit is contained in:
parent
f4dc9cc6a2
commit
4762711c33
2 changed files with 8 additions and 15 deletions
|
@ -166,24 +166,9 @@ class AuthorizationService:
|
||||||
"code_challenge_method": "S512"
|
"code_challenge_method": "S512"
|
||||||
})
|
})
|
||||||
|
|
||||||
# GITHUB issue #6194: https://github.com/Ultimaker/Cura/issues/6194
|
|
||||||
# With AppImage 2 on Linux, the current working directory will be somewhere in /tmp/<rand>/usr, which is owned
|
|
||||||
# by root. For some reason, QDesktopServices.openUrl() requires to have a usable current working directory,
|
|
||||||
# otherwise it doesn't work. This is a workaround on Linux that before we call QDesktopServices.openUrl(), we
|
|
||||||
# switch to a directory where the user has the ownership.
|
|
||||||
old_work_dir = ""
|
|
||||||
if Platform.isLinux():
|
|
||||||
# Change the working directory to user home
|
|
||||||
old_work_dir = os.getcwd()
|
|
||||||
os.chdir(os.path.expanduser("~"))
|
|
||||||
|
|
||||||
# Open the authorization page in a new browser window.
|
# Open the authorization page in a new browser window.
|
||||||
QDesktopServices.openUrl(QUrl("{}?{}".format(self._auth_url, query_string)))
|
QDesktopServices.openUrl(QUrl("{}?{}".format(self._auth_url, query_string)))
|
||||||
|
|
||||||
if Platform.isLinux():
|
|
||||||
# Change the working directory back
|
|
||||||
os.chdir(old_work_dir)
|
|
||||||
|
|
||||||
# Start a local web server to receive the callback URL on.
|
# Start a local web server to receive the callback URL on.
|
||||||
self._server.start(verification_code)
|
self._server.start(verification_code)
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,14 @@ if Platform.isWindows() and hasattr(sys, "frozen"):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# GITHUB issue #6194: https://github.com/Ultimaker/Cura/issues/6194
|
||||||
|
# With AppImage 2 on Linux, the current working directory will be somewhere in /tmp/<rand>/usr, which is owned
|
||||||
|
# by root. For some reason, QDesktopServices.openUrl() requires to have a usable current working directory,
|
||||||
|
# otherwise it doesn't work. This is a workaround on Linux that before we call QDesktopServices.openUrl(), we
|
||||||
|
# switch to a directory where the user has the ownership.
|
||||||
|
if Platform.isLinux() and hasattr(sys, "frozen"):
|
||||||
|
os.chdir(os.path.expanduser("~"))
|
||||||
|
|
||||||
# WORKAROUND: GITHUB-704 GITHUB-708
|
# WORKAROUND: GITHUB-704 GITHUB-708
|
||||||
# It looks like setuptools creates a .pth file in
|
# It looks like setuptools creates a .pth file in
|
||||||
# the default /usr/lib which causes the default site-packages
|
# the default /usr/lib which causes the default site-packages
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue