mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 14:10:27 -04:00
26 lines
547 B
C++
26 lines
547 B
C++
#include "../save_folder.h"
|
|
#include "../error.h"
|
|
#include <filesystem>
|
|
|
|
static std::string get_default_savegame_dir() {
|
|
|
|
// Linux
|
|
char* home = std::getenv("HOME");
|
|
if (home) {
|
|
return std::filesystem::path(home) / ".local/share/" SAVEGAME_FOLDERNAME;
|
|
} else {
|
|
throw std::runtime_error("$HOME has no value (user with no home)");
|
|
abort();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *get_default_savegame_directory(void) {
|
|
|
|
static std::string dir = get_default_savegame_dir();
|
|
return dir.c_str();
|
|
|
|
|
|
}
|