forked from oerkki/voxelands
Merge branch 'next' of gitlab.com:voxelands/voxelands into next
This commit is contained in:
commit
9e7f41145a
|
@ -4,6 +4,7 @@ build64
|
|||
|
||||
bin/
|
||||
*.a
|
||||
*.o
|
||||
|
||||
*.swp
|
||||
merge.sh
|
||||
|
@ -12,6 +13,7 @@ world/
|
|||
voxelands.conf
|
||||
locale/
|
||||
*debug.txt
|
||||
*.core
|
||||
|
||||
*CMakeFiles/
|
||||
*Makefile
|
||||
|
|
|
@ -182,31 +182,43 @@ void initializePaths()
|
|||
Linux
|
||||
*/
|
||||
#elif defined(linux)
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char buf[BUFSIZ];
|
||||
memset(buf, 0, BUFSIZ);
|
||||
// Get path to executable
|
||||
assert(readlink("/proc/self/exe", buf, BUFSIZ-1) != -1);
|
||||
|
||||
pathRemoveFile(buf, '/');
|
||||
pathRemoveFile(buf, '/');
|
||||
|
||||
// Use "./bin/../data"
|
||||
path_data = std::string(buf) + "/../data";
|
||||
path_data = std::string(buf) + "/data";
|
||||
|
||||
// Use "./bin/../"
|
||||
path_userdata = std::string(buf) + "/..";
|
||||
path_userdata = std::string(buf);
|
||||
|
||||
/*
|
||||
OS X
|
||||
*/
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
|
||||
//TODO: Get path of executable. This assumes working directory is bin/
|
||||
dstream<<"WARNING: Relative path not properly supported on OS X and FreeBSD"
|
||||
<<std::endl;
|
||||
path_data = std::string("../data");
|
||||
path_userdata = std::string("..");
|
||||
const int info[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||
char* path = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
sysctl(info, 4, NULL, &size, NULL, 0);
|
||||
path = (char*) malloc(size);
|
||||
|
||||
sysctl(info, 4, path, &size, NULL, 0);
|
||||
|
||||
pathRemoveFile(path, '/');
|
||||
pathRemoveFile(path, '/');
|
||||
|
||||
path_userdata = std::string(path);
|
||||
path_data = std::string(path) + "/data";
|
||||
|
||||
delete path ;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
#define sleep_ms(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
namespace porting
|
||||
{
|
||||
|
||||
|
|
6505
src/sqlite/sqlite3.c
6505
src/sqlite/sqlite3.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue