Windows support
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "Game.h"
|
||||
#include "Log.h"
|
||||
#include "Net.h"
|
||||
#include "Paths.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@@ -35,16 +36,7 @@ std::atomic<bool> gStop{false};
|
||||
|
||||
void onSignal(int) { gStop = true; }
|
||||
|
||||
std::string defaultDbPath() {
|
||||
std::string base;
|
||||
if (const char* x = std::getenv("XDG_DATA_HOME"); x && *x) base = x;
|
||||
#if defined(_WIN32)
|
||||
else if (const char* a = std::getenv("APPDATA"); a && *a) base = a;
|
||||
#endif
|
||||
else if (const char* h = std::getenv("HOME"); h && *h) base = std::string(h) + "/.local/share";
|
||||
else base = ".";
|
||||
return base + "/brandling-safari/world.db";
|
||||
}
|
||||
std::string defaultDbPath() { return (userDataDir() / "world.db").string(); }
|
||||
|
||||
// Non-blocking stdin lines for the console. POSIX polls fd 0 from the tick loop (a reader thread
|
||||
// blocked inside stdio would deadlock glibc's exit-time stream flush); Windows uses a detached
|
||||
@@ -112,8 +104,8 @@ int main(int argc, char** argv) {
|
||||
uint16_t port = kDefaultPort;
|
||||
GameConfig cfg;
|
||||
std::string dbPath = defaultDbPath();
|
||||
std::string rosterPath = std::string(BS_ASSET_DIR) + "/creatures/roster.json";
|
||||
std::string manifestPath = std::string(BS_ASSET_DIR) + "/characters/manifest.json";
|
||||
std::string rosterPath = gameAssetDir() + "/creatures/roster.json";
|
||||
std::string manifestPath = gameAssetDir() + "/characters/manifest.json";
|
||||
bool seedGiven = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user