From 3f2f5f5ab1d3c041056bfdf063623da955dff68d Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Tue, 23 May 2023 10:27:56 +0200 Subject: [PATCH] Fix running osc in an AppImage by switching to the correct working directory --- osc/babysitter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osc/babysitter.py b/osc/babysitter.py index d04dfd91..0d2d3f4b 100644 --- a/osc/babysitter.py +++ b/osc/babysitter.py @@ -226,6 +226,13 @@ def main(): sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.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())) # vim: sw=4 et