summaryrefslogtreecommitdiff
path: root/src/porting.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-19 23:54:56 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-20 00:08:00 +0200
commit97b693052cd5da228016afa6b31f07970b37569a (patch)
treea5389b936e6bf110de7c3463cd1d04e4a37f484a /src/porting.cpp
parent19ed3bb1937419b5efdac4f4b6c07869e6bc6f08 (diff)
downloadminetest-97b693052cd5da228016afa6b31f07970b37569a.tar.gz
minetest-97b693052cd5da228016afa6b31f07970b37569a.tar.bz2
minetest-97b693052cd5da228016afa6b31f07970b37569a.zip
Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
Diffstat (limited to 'src/porting.cpp')
-rw-r--r--src/porting.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/porting.cpp b/src/porting.cpp
index 92615d77a..522afa9ef 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -123,8 +123,9 @@ void signal_handler_init(void)
Path mangler
*/
-std::string path_share = ".." DIR_DELIM "share";
-std::string path_user = ".." DIR_DELIM "user";
+// Default to RUN_IN_PLACE style relative paths
+std::string path_share = "..";
+std::string path_user = "..";
std::string getDataPath(const char *subpath)
{
@@ -167,8 +168,8 @@ void initializePaths()
assert(len < buflen);
pathRemoveFile(buf, '\\');
- path_share = std::string(buf) + "\\..\\share";
- path_user = std::string(buf) + "\\..\\user";
+ path_share = std::string(buf) + "\\..";
+ path_user = std::string(buf) + "\\..";
/*
Linux
@@ -183,8 +184,8 @@ void initializePaths()
pathRemoveFile(buf, '/');
- path_share = std::string(buf) + "/../share";
- path_user = std::string(buf) + "/../user";
+ path_share = std::string(buf) + "/..";
+ path_user = std::string(buf) + "/..";
/*
OS X
@@ -194,8 +195,8 @@ void initializePaths()
//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_share = std::string("../share");
- path_user = std::string("../user");
+ path_share = std::string("..");
+ path_user = std::string("..");
#endif
@@ -222,8 +223,8 @@ void initializePaths()
assert(len < buflen);
pathRemoveFile(buf, '\\');
- // Use ".\bin\..\share"
- path_share = std::string(buf) + "\\..\\share";
+ // Use ".\bin\.."
+ path_share = std::string(buf) + "\\..";
// Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
len = GetEnvironmentVariable("APPDATA", buf, buflen);
@@ -247,7 +248,7 @@ void initializePaths()
//path_share = std::string(INSTALL_PREFIX) + "/share/" + PROJECT_NAME;
if (!fs::PathExists(path_share)) {
dstream<<"WARNING: system-wide share not found at \""<<path_share<<"\"";
- path_share = std::string(buf) + "/../share";
+ path_share = std::string(buf) + "/..";
dstream<<"WARNING: Using \""<<path_share<<"\" instead."<<std::endl;
}