From 3f70006283824f37b141b1b24919b2e6ea797833 Mon Sep 17 00:00:00 2001 From: "bill@Ixion" Date: Sun, 22 Nov 2009 16:42:34 -0600 Subject: [PATCH] Fixed Filesystem::getWorkingDirectory() so that it actually compiles on non-Windows systems. --- src/modules/filesystem/physfs/Filesystem.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index 88bc52151..ad7c10eee 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -163,13 +163,13 @@ namespace physfs cwd = to_utf8(w_cwd); replace_char(cwd, '\\', '/'); #else - cwd = new char[LOVE_MAX_PATH]; + char * cwd_char = new char[LOVE_MAX_PATH]; - if(!getcwd(cwd, LOVE_MAX_PATH)) - { - delete [] cwd; - cwd = 0; - } + getcwd(cwd_char, LOVE_MAX_PATH); + + cwd = cwd_char; // if getcwd fails, cwd_char (and thus cwd) will still be empty + + delete [] cwd_char; #endif } @@ -191,7 +191,7 @@ namespace physfs replace_char(appdata, '\\', '/'); } return appdata.c_str(); -#elif defined(LOVE_MACOSX +#elif defined(LOVE_MACOSX) if(appdata.empty()) { std::string udir = getUserDirectory();