changed camera to show more of what's above tux
[supertux.git] / src / main.cpp
index 1ce98bc..950da90 100644 (file)
@@ -97,27 +97,31 @@ static void find_directories()
   }
 
   // Detect datadir with some linux magic
-#ifndef WIN32
   if(datadir.empty()) {
+    std::string exedir;
+#ifdef WIN32
+    exedir = ".";
+#else
     char exe_file[PATH_MAX];
-    if(readlink("/proc/self/exe", exe_file, PATH_MAX) < 0) {
+    if(readlink("/proc/self/exe", exe_file, PATH_MAX) >= 0) {
+      exedir = std::string(dirname(exe_file));
+    } else {
 #ifdef DEBUG
       std::cerr << "Couldn't read /proc/self/exe \n";
 #endif
-    } else {
-      std::string exedir = std::string(dirname(exe_file)) + "/";
-      std::string testdir = exedir + "./data/";
-      if(access(testdir.c_str(), F_OK) == 0) {
-        datadir = testdir;
-      }
-      
-      testdir = exedir + "../share/supertux/";
-      if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
-        datadir = testdir;
-      }
-    }  
-  }
+      exedir = ".";
+    }
 #endif
+    std::string testdir = exedir + "/data/";
+    if(access(testdir.c_str(), F_OK) == 0) {
+      datadir = testdir;
+    }
+    
+    testdir = exedir + "/../share/supertux/";
+    if(datadir.empty() && access(testdir.c_str(), F_OK) == 0) {
+      datadir = testdir;
+    }
+  }  
   
 #ifdef DATA_PREFIX
   // use default location