aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/main.cpp5
-rw-r--r--src/porting.cpp23
-rw-r--r--src/subgame.cpp5
4 files changed, 14 insertions, 22 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 448f2f6b8..16ab45c5c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -313,7 +313,8 @@ endif()
if(BUILD_CLIENT)
install(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../share/" DESTINATION ${SHAREDIR})
+ #install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../sounds/base/pack" DESTINATION "${SHAREDIR}/sounds/base/")
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../textures/base/pack" DESTINATION "${SHAREDIR}/textures/base/")
if(USE_GETTEXT)
foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
diff --git a/src/main.cpp b/src/main.cpp
index 35595e5aa..75ff569aa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1034,12 +1034,7 @@ int main(int argc, char *argv[])
// Check if the world is found from the default directory, and if
// not, see if the legacy world directory exists.
world_path = porting::path_user + DIR_DELIM + "worlds" + DIR_DELIM + "world";
-#ifdef RUN_IN_PLACE
- std::string legacy_world_path = porting::path_user + DIR_DELIM +
- ".." + DIR_DELIM + "world";
-#else
std::string legacy_world_path = porting::path_user + DIR_DELIM + "world";
-#endif
if(!fs::PathExists(world_path) && fs::PathExists(legacy_world_path)){
errorstream<<"Warning: Using legacy world directory \""
<<legacy_world_path<<"\""<<std::endl;
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;
}
diff --git a/src/subgame.cpp b/src/subgame.cpp
index b4ae3185e..e55f1bc97 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -124,12 +124,7 @@ std::vector<WorldSpec> getAvailableWorlds()
}
// Check old world location
do{
-#ifdef RUN_IN_PLACE
- std::string fullpath = porting::path_user + DIR_DELIM + ".."
- + DIR_DELIM + "world";
-#else
std::string fullpath = porting::path_user + DIR_DELIM + "world";
-#endif
if(!fs::PathExists(fullpath))
break;
std::string name = "Old World";