From: RĂ©mi Verschelde Date: Sat, 3 Dec 2016 22:21:29 +0000 (+0100) Subject: Fix regression in fallback logic on Linux X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=9f5ea9b1ee67471d2f4031dcd2aef6ea62a8265e Fix regression in fallback logic on Linux Regression from 11ff9aec2c3206a5b9df5bf8815051458628c45a --- diff --git a/Source/Utils/Folders.cpp b/Source/Utils/Folders.cpp index 33d3b15..9a6f813 100644 --- a/Source/Utils/Folders.cpp +++ b/Source/Utils/Folders.cpp @@ -86,12 +86,12 @@ std::string Folders::getConfigFilePath() std::string Folders::getGenericDirectory(const char* ENVVAR, const std::string fallback) { const char* path = getenv(ENVVAR); std::string ret; - if((path != NULL) && (strlen(path) != 0)) { + if ((path != NULL) && (strlen(path) != 0)) { ret = std::string(path) + "/lugaru"; } else { - path = getHomeDirectory(); - if((path != NULL) && (strlen(path) != 0)) { - ret = std::string(path) + '/' + fallback + "/lugaru"; + const char* homedir = getHomeDirectory(); + if ((homedir != NULL) && (strlen(homedir) != 0)) { + ret = std::string(homedir) + '/' + fallback + "/lugaru"; } else { ret = "."; } @@ -116,7 +116,7 @@ const char* Folders::getHomeDirectory() bool Folders::makeDirectory(std::string path) { #ifdef _WIN32 int status = CreateDirectory(path.c_str(), NULL); - if(status != 0) { + if (status != 0) { return true; } else if(GetLastError() == ERROR_ALREADY_EXISTS) { return true;