From 60c827cf0c324533771e555738946de633017a85 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 11 Aug 2015 21:31:57 +0200 Subject: [PATCH] linux-dist: Clean up home dir detection --- core/linux-dist/main.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index cea9db5c3..c142f0e4a 100755 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -786,19 +786,16 @@ int main(int argc, wchar* argv[]) signal(SIGKILL, clean_exit); #endif -#if defined(USES_HOMEDIR) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) - string home = (string)getenv("HOME"); - if(home.c_str()) - { - home += "/.reicast"; - mkdir(home.c_str(), 0755); // create the directory if missing - SetHomeDir(home); - } - else - SetHomeDir("."); -#else - SetHomeDir("."); -#endif + string home = "."; + #if defined(USES_HOMEDIR) && HOST_OS != OS_DARWIN && !defined(TARGET_EMSCRIPTEN) + if(getenv("HOME") != NULL) + { + home = (string)getenv("HOME") + "/.reicast"; + mkdir(home.c_str(), 0755); // create the directory if missing + } + #endif + SetHomeDir(home); + printf("Home dir is: %s\n", GetPath("/").c_str()); #if defined(SUPPORT_X11) x11_keymap[113] = DPad_Left; @@ -821,8 +818,6 @@ int main(int argc, wchar* argv[]) x11_keymap[36] = Btn_Start; #endif - printf("Home dir is: %s\n",GetPath("/").c_str()); - common_linux_setup(); SetupInput();