mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-06 17:09:06 +01:00
fix linux build
This commit is contained in:
parent
37d79c5e33
commit
86337466c8
2 changed files with 19 additions and 1 deletions
2
.github/workflows/story_editor.yml
vendored
2
.github/workflows/story_editor.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -202,6 +202,12 @@ std::string getExecutablePath()
|
|||
#include <sstream>
|
||||
// Typically Linux. For easy reading the comments will just say Linux but should work with most *nixes
|
||||
|
||||
#include <libgen.h> // dirname
|
||||
#include <unistd.h> // readlink
|
||||
#include <linux/limits.h> // 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue