Removed tile_path from tileset, instead give fully qualified path to the Tile
[supertux.git] / src / supertux / main.cpp
index 73e4e7d..31d8f43 100644 (file)
@@ -14,8 +14,6 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include "supertux/main.hpp"
-
 #include <config.h>
 #include <version.h>
 
@@ -25,6 +23,8 @@
 #include <binreloc.h>
 #include <tinygettext/log.hpp>
 
+#include "supertux/main.hpp"
+
 #ifdef MACOSX
 namespace supertux_apple {
 #  include <CoreFoundation/CoreFoundation.h>
@@ -93,7 +93,7 @@ Main::init_physfs(const char* argv0)
 
   // Initialize physfs (this is a slightly modified version of
   // PHYSFS_setSaneConfig
-  const char* application = "supertux2"; //instead of PACKAGE_NAME so we can coexist with MS1
+  const char* application = PACKAGE_NAME;
   const char* userdir = PHYSFS_getUserDir();
   char* writedir = new char[strlen(userdir) + strlen(application) + 2];
 
@@ -176,23 +176,21 @@ Main::init_physfs(const char* argv0)
 #endif
 
   if(!sourcedir) {
-#if defined(APPDATADIR) || defined(ENABLE_BINRELOC)
-    std::string datadir;
+    std::string datadir = PHYSFS_getBaseDir();
+    datadir = datadir.substr(0, datadir.rfind(INSTALL_SUBDIR_BIN));
+    datadir += "/" INSTALL_SUBDIR_SHARE;
 #ifdef ENABLE_BINRELOC
 
     char* dir;
     br_init (NULL);
-    dir = br_find_data_dir(APPDATADIR);
+    dir = br_find_data_dir(datadir.c_str());
     datadir = dir;
     free(dir);
 
-#else
-    datadir = APPDATADIR;
 #endif
     if(!PHYSFS_addToSearchPath(datadir.c_str(), 1)) {
       log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
     }
-#endif
   }
 
   //show search Path
@@ -528,7 +526,7 @@ static inline void timelog(const char* )
 #endif
 
 int
-Main::main(int argc, char** argv)
+Main::run(int argc, char** argv)
 {
   int result = 0;