diff options
author | Aaron Suen <warr1024@gmail.com> | 2013-08-25 12:19:31 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2013-11-02 13:41:26 -0400 |
commit | 2636c92075196b4c2cd65327b1f839f1e8919b83 (patch) | |
tree | 7237d1afdf9b68347d82166406754001baf1b98c /src | |
parent | d11c76b9f2ed111d933fe0df3cc5c87c8aff4f73 (diff) | |
download | minetest-2636c92075196b4c2cd65327b1f839f1e8919b83.tar.gz minetest-2636c92075196b4c2cd65327b1f839f1e8919b83.tar.bz2 minetest-2636c92075196b4c2cd65327b1f839f1e8919b83.zip |
Portability fixes for OpenBSD (and possibly NetBSD and others).
Diffstat (limited to 'src')
-rw-r--r-- | src/porting.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/porting.cpp b/src/porting.cpp index 84df15b30..a080a44e5 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -373,8 +373,13 @@ void initializePaths() //TODO: Get path of executable. This assumes working directory is bin/ dstream<<"WARNING: Relative path not properly supported on this platform" <<std::endl; - path_share = std::string(".."); - path_user = std::string(".."); + + /* scriptapi no longer allows paths that start with "..", so assuming that + the current working directory is bin/, strip off the last component. */ + char *cwd = getcwd(NULL, 0); + pathRemoveFile(cwd, '/'); + path_share = std::string(cwd); + path_user = std::string(cwd); #endif @@ -477,7 +482,7 @@ void initializePaths() path_user = std::string(getenv("HOME")) + "/Library/Application Support/" + PROJECT_NAME; - #elif defined(__FreeBSD__) + #else // FreeBSD, and probably many other POSIX-like systems. path_share = STATIC_SHAREDIR; path_user = std::string(getenv("HOME")) + "/." + PROJECT_NAME; |