1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 16:26:13 +01:00

Fix running osc in an AppImage by switching to the correct working directory

This commit is contained in:
Daniel Mach 2023-05-23 10:27:56 +02:00
parent 58c5a3074a
commit 3f2f5f5ab1

View File

@ -226,6 +226,13 @@ def main():
sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.mode, 1) sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.mode, 1)
sys.stderr = os.fdopen(sys.stderr.fileno(), sys.stderr.mode, 1) sys.stderr = os.fdopen(sys.stderr.fileno(), sys.stderr.mode, 1)
appimage = os.getenv("APPIMAGE", None)
owd = os.getenv("OWD", None)
if appimage and owd:
# OWD stands for Original Working Directory and we need to switch there when running in an AppImage
# https://docs.appimage.org/packaging-guide/environment-variables.html
os.chdir(owd)
sys.exit(run(commandline.OscMainCommand())) sys.exit(run(commandline.OscMainCommand()))
# vim: sw=4 et # vim: sw=4 et