From 0bd9d70ece8b3582c3fca7e025397fc5c0d87ceb Mon Sep 17 00:00:00 2001 From: Ivan Savu Date: Fri, 30 Aug 2019 15:58:06 +0200 Subject: [PATCH] Fixed file handling for Linux. --- Backends/System/Linux/Sources/Kore/System.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Backends/System/Linux/Sources/Kore/System.cpp b/Backends/System/Linux/Sources/Kore/System.cpp index af74f6cd3..4343a0298 100644 --- a/Backends/System/Linux/Sources/Kore/System.cpp +++ b/Backends/System/Linux/Sources/Kore/System.cpp @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -941,9 +946,19 @@ namespace { const char* kinc_internal_save_path() { if (!saveInitialized) { - strcpy(save, "ΔΆ~/."); + const char *homedir; + + if ((homedir = getenv("HOME")) == NULL) { + homedir = getpwuid(getuid())->pw_dir; + } + + strcpy(save, homedir); + strcat(save, "/."); strcat(save, kinc_application_name()); strcat(save, "/"); + + int res = mkdir(save, 0700); + saveInitialized = true; } return save; @@ -992,6 +1007,7 @@ int kinc_init(const char* name, int width, int height, kinc_window_options_t *wi gettimeofday(&start, NULL); enumerateDisplays(); + kinc_set_application_name(name); //System::_init(name, width, height, &win, &frame); kinc_window_options_t defaultWin; if (win == NULL) {