X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FUtils%2FFolders.cpp;h=9a6f8137a536ba574dca9db8b075baebc693cd39;hb=9f5ea9b1ee67471d2f4031dcd2aef6ea62a8265e;hp=33d3b15cfdc6c8e8f85e02c1ab81137bb7c86bb7;hpb=38f5e6366de921c4d127c9f8e3e0113cc33ac595;p=lugaru.git 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;