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:
|
build_win:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,12 @@ std::string getExecutablePath()
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
// Typically Linux. For easy reading the comments will just say Linux but should work with most *nixes
|
// 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)
|
static void throwOnRelative(const char *envName, const char *envValue)
|
||||||
{
|
{
|
||||||
if (envValue[0] != '/')
|
if (envValue[0] != '/')
|
||||||
|
|
@ -265,6 +271,18 @@ namespace pf
|
||||||
}
|
}
|
||||||
#endif
|
#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()
|
std::string getDataHome()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue