diff --git a/build/linux/Makefile b/build/linux/Makefile index 810c1fd..9051926 100644 --- a/build/linux/Makefile +++ b/build/linux/Makefile @@ -14,7 +14,7 @@ CXXFLAGS+=$(DEBUG) -Wall `sdl2-config --cflags` -I../../src -I../../src/states - LDFLAGS+= -Wall -L../../../sdl/$(LIB_DIR) -Wl,-rpath=$(LIB_DIR)/ -lSDL2 -lSDL2_image -lpthread -Wl,--no-undefined -lm -ldl -pthread -lrt -Wl,-Bstatic -lGLEW -Wl,-Bdynamic -lGL VPATH=../../src BINARY=RtB$(BITS) -OBJ=main.o Asset.o AssetCache.o AssetManager.o Core.o fio.o checksum.o Log.o Quat.o Mat4.o Vec.o Mesh.o Texture.o Program.o RenderScene.o RenderSet.o RenderObject.o RenderCamera.o RenderView.o states/TestState.o states/MenuState.o Gui.o gui/GuiElement.o +OBJ=main.o Asset.o AssetCache.o AssetManager.o Core.o fio.o checksum.o Log.o Quat.o Mat4.o Vec.o Mesh.o Texture.o Program.o RenderScene.o RenderSet.o RenderObject.o RenderCamera.o RenderView.o states/TestState.o states/MenuState.o SysInfo.o Gui.o gui/GuiElement.o gui/GuiButton.o gui/GuiList.o OBJ_DIR=obj $(BINARY): $(patsubst %,$(OBJ_DIR)/%,$(OBJ)) diff --git a/src/Core.cpp b/src/Core.cpp index c41ee32..1e93d08 100644 --- a/src/Core.cpp +++ b/src/Core.cpp @@ -150,11 +150,8 @@ int Core::initSystem() { #elif _WIN32 asset_manager->addCache(new AssetCache("data")); #else // assume lunix - char *path = getenv("HOME"); - if (path == NULL) path = getpwuid(getuid())->pw_dir; - char user_dir[PATH_MAX]; - snprintf(user_dir, PATH_MAX, "%s/RtB", path); struct stat dir_check = {0}; + char *user_dir = (char*)sysinfo.user_dir.c_str(); if (stat(user_dir, &dir_check) == -1) { mkdir(user_dir, 0700); } diff --git a/src/SysInfo.cpp b/src/SysInfo.cpp index d192ca6..934670c 100644 --- a/src/SysInfo.cpp +++ b/src/SysInfo.cpp @@ -4,6 +4,13 @@ #include #include #include +#elif defined(_WIN32) +#else +#include //snprintf +#include // getenv +#include // getuid +#include +#include // getpwuid #endif @@ -22,6 +29,13 @@ SysInfo::SysInfo() { char path_dir[PATH_MAX]; snprintf(path_dir, PATH_MAX, "%s/RtB", path); user_dir.assign(path_dir); + #elif defined(_WIN32) + #elif !defined(__ANDROID__) + char *path = getenv("HOME"); + if (path == NULL) path = getpwuid(getuid())->pw_dir; + char path_dir[1024]; + snprintf(path_dir, 1024, "%s/RtB", path); + user_dir.assign(path_dir); #endif } SysInfo::~SysInfo() {