]> git.jsancho.org Git - lugaru.git/blobdiff - Source/main.cpp
Fix unused-result warning for chdir
[lugaru.git] / Source / main.cpp
index 19bfa6ecde6ccee12be0c00bdbc254fcf99ba49e..cacfabdc99b2a0632e8b759636a39b00d73151d9 100644 (file)
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 2003, 2010 - Wolfire Games
-Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
+Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
 
 This file is part of Lugaru.
 
@@ -22,7 +22,7 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "Audio/openal_wrapper.hpp"
 #include "Graphic/gamegl.hpp"
-#include "MacCompatibility.hpp"
+#include "Platform/Platform.hpp"
 #include "User/Settings.hpp"
 #include "Version.hpp"
 
@@ -32,14 +32,14 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 #include <set>
 #include <stdio.h>
 #include <string.h>
-#include <zlib.h>
 
 using namespace Game;
 
 #ifdef WIN32
-#include "win-res/resource.hpp"
 #include <shellapi.h>
 #include <windows.h>
+#else
+#include <unistd.h>
 #endif
 
 extern float multiplier;
@@ -579,7 +579,10 @@ static inline void chdirToAppPath(const char* argv0)
                 *ptr = '\0';
         }
 #endif
-        chdir(dir);
+        errno = 0;
+        if (chdir(dir) != 0) {
+            printf("Error changing dir to '%s' (%s).\n", dir, strerror(errno));
+        }
         free(dir);
     }
 }