[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] [pingus] push by address@hidden - On OSX, ping can be launc
From: |
pingus |
Subject: |
[Pingus-CVS] [pingus] push by address@hidden - On OSX, ping can be launch from source directory again on 2011-12-29 01:15 GMT |
Date: |
Thu, 29 Dec 2011 01:16:53 +0000 |
Revision: 53368c10be99
Author: Josh Dye <address@hidden>
Date: Wed Dec 28 17:15:00 2011
Log: On OSX, ping can be launch from source directory again
http://code.google.com/p/pingus/source/detail?r=53368c10be99
Modified:
/src/pingus/pingus_main.cpp
=======================================
--- /src/pingus/pingus_main.cpp Tue Dec 27 17:28:31 2011
+++ /src/pingus/pingus_main.cpp Wed Dec 28 17:15:00 2011
@@ -35,6 +35,9 @@
/* Can't use the include, some type names conflict.
#include <CoreFoundation/CoreFoundation.h>
*/
+#include <unistd.h>
+#include <strings.h>
+#include <SYS/stat.h>
extern "C" {
typedef unsigned char UInt8;
typedef void* CFTypeRef;
@@ -426,6 +429,14 @@
}
}
}
+
+#if defined(__APPLE__)
+ int fexist( char *filename ) {
+ struct stat buffer ;
+ if ( stat( filename, &buffer ) ) return 1 ;
+ return 0 ;
+ }
+#endif
// Get all filenames and directories
void
@@ -443,6 +454,8 @@
else
{ // do magic to guess the datadir
#if defined(__APPLE__)
+ char path[PATH_MAX];
+ getcwd(path, PATH_MAX);
char resource_path[PATH_MAX];
CFURLRef ref =
CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
if (!ref || !CFURLGetFileSystemRepresentation(ref, true,
(UInt8*)resource_path, PATH_MAX))
@@ -450,8 +463,15 @@
std::cout << "Error: Couldn't get Resources path.\n" << std::endl;
exit(EXIT_FAILURE);
}
- CFRelease(ref);
- g_path_manager.set_path(resource_path);
+ if (fexist(strcat(path,"data")))
+ {
+ g_path_manager.set_path("data"); // assume game is run from source
dir
+ }
+ else
+ {
+ CFRelease(ref);
+ g_path_manager.set_path(resource_path);
+ }
#else
g_path_manager.set_path("data"); // assume game is run from source dir
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] [pingus] push by address@hidden - On OSX, ping can be launch from source directory again on 2011-12-29 01:15 GMT,
pingus <=