(svn r11116) -Fix (r11106): tar loader was not compiled for WIN32
authorglx
Sat, 15 Sep 2007 15:21:17 +0000
changeset 7589 f989c4d11269
parent 7588 718c230635a6
child 7590 08e4689e05b3
(svn r11116) -Fix (r11106): tar loader was not compiled for WIN32
src/fileio.cpp
src/win32.cpp
--- a/src/fileio.cpp	Sat Sep 15 12:43:04 2007 +0000
+++ b/src/fileio.cpp	Sat Sep 15 15:21:17 2007 +0000
@@ -16,8 +16,8 @@
 #else
 #include <pwd.h>
 #include <unistd.h>
+#endif
 #include <sys/stat.h>
-#endif
 
 /*************************************************/
 /* FILE IO ROUTINES ******************************/
@@ -477,41 +477,6 @@
 	return dest;
 }
 
-#if defined(WIN32) || defined(WINCE)
-/**
- * Determine the base (personal dir and game data dir) paths
- * @param exe the path from the current path to the executable
- * @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc)
- */
-extern void DetermineBasePaths(const char *exe);
-#else /* defined(WIN32) || defined(WINCE) */
-
-/**
- * Changes the working directory to the path of the give executable.
- * For OSX application bundles '.app' is the required extension of the bundle,
- * so when we crop the path to there, when can remove the name of the bundle
- * in the same way we remove the name from the executable name.
- * @param exe the path to the executable
- */
-void ChangeWorkingDirectory(const char *exe)
-{
-#ifdef WITH_COCOA
-	char *app_bundle = strchr(exe, '.');
-	while (app_bundle != NULL && strncasecmp(app_bundle, ".app", 4) != 0) app_bundle = strchr(&app_bundle[1], '.');
-
-	if (app_bundle != NULL) app_bundle[0] = '\0';
-#endif /* WITH_COCOA */
-	char *s = strrchr(exe, PATHSEPCHAR);
-	if (s != NULL) {
-		*s = '\0';
-		chdir(exe);
-		*s = PATHSEPCHAR;
-	}
-#ifdef WITH_COCOA
-	if (app_bundle != NULL) app_bundle[0] = '.';
-#endif /* WITH_COCOA */
-}
-
 static bool TarListAddFile(const char *filename)
 {
 	/* See if we already have a tar by that name; useless to have double entries in our list */
@@ -566,7 +531,7 @@
 	return num;
 }
 
-static void ScanForTarFiles()
+void ScanForTarFiles()
 {
 	Searchpath sp;
 	char path[MAX_PATH];
@@ -580,6 +545,41 @@
 	DEBUG(misc, 1, "Scan complete, found %d files", num);
 }
 
+#if defined(WIN32) || defined(WINCE)
+/**
+ * Determine the base (personal dir and game data dir) paths
+ * @param exe the path from the current path to the executable
+ * @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc)
+ */
+extern void DetermineBasePaths(const char *exe);
+#else /* defined(WIN32) || defined(WINCE) */
+
+/**
+ * Changes the working directory to the path of the give executable.
+ * For OSX application bundles '.app' is the required extension of the bundle,
+ * so when we crop the path to there, when can remove the name of the bundle
+ * in the same way we remove the name from the executable name.
+ * @param exe the path to the executable
+ */
+void ChangeWorkingDirectory(const char *exe)
+{
+#ifdef WITH_COCOA
+	char *app_bundle = strchr(exe, '.');
+	while (app_bundle != NULL && strncasecmp(app_bundle, ".app", 4) != 0) app_bundle = strchr(&app_bundle[1], '.');
+
+	if (app_bundle != NULL) app_bundle[0] = '\0';
+#endif /* WITH_COCOA */
+	char *s = strrchr(exe, PATHSEPCHAR);
+	if (s != NULL) {
+		*s = '\0';
+		chdir(exe);
+		*s = PATHSEPCHAR;
+	}
+#ifdef WITH_COCOA
+	if (app_bundle != NULL) app_bundle[0] = '.';
+#endif /* WITH_COCOA */
+}
+
 /**
  * Determine the base (personal dir and game data dir) paths
  * @param exe the path to the executable
--- a/src/win32.cpp	Sat Sep 15 12:43:04 2007 +0000
+++ b/src/win32.cpp	Sat Sep 15 15:21:17 2007 +0000
@@ -1031,6 +1031,7 @@
 
 void DetermineBasePaths(const char *exe)
 {
+	extern void ScanForTarFiles();
 	char tmp[MAX_PATH];
 	TCHAR path[MAX_PATH];
 #ifdef WITH_PERSONAL_DIR
@@ -1076,6 +1077,8 @@
 
 	_searchpaths[SP_INSTALLATION_DIR]       = NULL;
 	_searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL;
+
+	ScanForTarFiles();
 }
 
 /**