diff --git a/.github/workflows/story_editor.yml b/.github/workflows/story_editor.yml index 894da44..5d18572 100644 --- a/.github/workflows/story_editor.yml +++ b/.github/workflows/story_editor.yml @@ -9,7 +9,7 @@ jobs: build_win: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive - name: Install packages diff --git a/story-editor/src/platform_folders.cpp b/story-editor/src/platform_folders.cpp index 5f86c9d..64dd1f0 100644 --- a/story-editor/src/platform_folders.cpp +++ b/story-editor/src/platform_folders.cpp @@ -202,6 +202,12 @@ std::string getExecutablePath() #include // Typically Linux. For easy reading the comments will just say Linux but should work with most *nixes +#include // dirname +#include // readlink +#include // PATH_MAX + + + static void throwOnRelative(const char *envName, const char *envValue) { if (envValue[0] != '/') @@ -265,6 +271,18 @@ namespace pf } #endif + + std::string getExecutablePath() + { + char result[PATH_MAX]; + ssize_t count = readlink("/proc/self/exe", result, PATH_MAX); + const char *path; + if (count != -1) { + path = dirname(result); + } + return path; + } + std::string getDataHome() { #ifdef _WIN32