From 9f5ea9b1ee67471d2f4031dcd2aef6ea62a8265e Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 3 Dec 2016 23:21:29 +0100 Subject: [PATCH] Fix regression in fallback logic on Linux Regression from 11ff9aec2c3206a5b9df5bf8815051458628c45a --- Source/Utils/Folders.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.39.2