From bbac7e479cb6ff46bac5deb72dcb2d54581df37e Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 20 Apr 2022 23:00:48 +0200 Subject: [PATCH] Set the correct working directory for the AppImage version (#937) --- data/core/start.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/data/core/start.lua b/data/core/start.lua index b3bcc18e..b6f1ee6a 100644 --- a/data/core/start.lua +++ b/data/core/start.lua @@ -34,3 +34,12 @@ table.pack = table.pack or pack or function(...) return {...} end table.unpack = table.unpack or unpack bit32 = bit32 or require "core.bit" + +-- Because AppImages change the working directory before running the executable, +-- we need to change it back to the original one. +-- https://github.com/AppImage/AppImageKit/issues/172 +-- https://github.com/AppImage/AppImageKit/pull/191 +local appimage_owd = os.getenv("OWD") +if os.getenv("APPIMAGE") and appimage_owd then + system.chdir(appimage_owd) +end