summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-19 20:44:07 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-19 20:44:07 +0200
commit1f56d71f190c67325bdc413dfbc6c8e4b8284d98 (patch)
tree04c5ad77c48d9d38899ae9e8b5509b1c94ab30ac /src
parent1ff20da5b689d1a5e5a89f7ca086d88bc47f837d (diff)
downloadminetest-1f56d71f190c67325bdc413dfbc6c8e4b8284d98.tar.gz
minetest-1f56d71f190c67325bdc413dfbc6c8e4b8284d98.tar.bz2
minetest-1f56d71f190c67325bdc413dfbc6c8e4b8284d98.zip
Rework directory structure
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp11
-rw-r--r--src/server.cpp6
-rw-r--r--src/server.h3
-rw-r--r--src/subgame.cpp24
4 files changed, 18 insertions, 26 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d08f88417..35595e5aa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1033,8 +1033,13 @@ int main(int argc, char *argv[])
// No specific world was commanded
// 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 + "server" + DIR_DELIM + "worlds" + DIR_DELIM + "world";
- std::string legacy_world_path = porting::path_user+DIR_DELIM+".."+DIR_DELIM+"world";
+ 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;
@@ -1445,7 +1450,7 @@ int main(int argc, char *argv[])
if(menudata.create_world_name != L"")
{
std::string path = porting::path_user + DIR_DELIM
- + "server" + DIR_DELIM + "worlds" + DIR_DELIM
+ "worlds" + DIR_DELIM
+ wide_to_narrow(menudata.create_world_name);
// Create world if it doesn't exist
if(!initializeWorld(path, menudata.create_world_gameid)){
diff --git a/src/server.cpp b/src/server.cpp
index df9a4d390..1060426b3 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -877,10 +877,6 @@ Server::Server(
if(!gamespec.isValid())
throw ServerError("Supplied invalid gamespec");
- // Figure out some paths
- // share/server
- m_path_share = porting::path_share + DIR_DELIM + "server";
-
infostream<<"Server created for gameid \""<<m_gamespec.id<<"\"";
if(m_simple_singleplayer_mode)
infostream<<" in simple singleplayer mode"<<std::endl;
@@ -894,7 +890,7 @@ Server::Server(
infostream<<"- addons: "<<(*i)<<std::endl;
// Path to builtin.lua
- std::string builtinpath = m_path_share + DIR_DELIM + "builtin.lua";
+ std::string builtinpath = porting::path_share + DIR_DELIM + "builtin.lua";
// Add default global mod search path
m_modspaths.push_front(m_gamespec.path + DIR_DELIM "mods");
diff --git a/src/server.h b/src/server.h
index 32ce8eb53..328c7fb9c 100644
--- a/src/server.h
+++ b/src/server.h
@@ -640,9 +640,6 @@ private:
// functionality
bool m_simple_singleplayer_mode;
- // Equivalent of /usr/share/minetest/server
- std::string m_path_share;
-
// Thread can set; step() will throw as ServerError
MutexedVariable<std::string> m_async_fatal_error;
diff --git a/src/subgame.cpp b/src/subgame.cpp
index d34530193..b4ae3185e 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -27,14 +27,13 @@ SubgameSpec findSubgame(const std::string &id)
{
if(id == "")
return SubgameSpec();
- std::string share_server = porting::path_share + DIR_DELIM + "server";
- std::string user_server = porting::path_user + DIR_DELIM + "server";
+ std::string share = porting::path_share;
+ std::string user = porting::path_user;
// Find game directory
- std::string game_path =
- user_server + DIR_DELIM + "games" + DIR_DELIM + id;
+ std::string game_path = user + DIR_DELIM + "games" + DIR_DELIM + id;
bool user_game = true; // Game is in user's directory
if(!fs::PathExists(game_path)){
- game_path = share_server + DIR_DELIM + "games" + DIR_DELIM + id;
+ game_path = share + DIR_DELIM + "games" + DIR_DELIM + id;
user_game = false;
}
if(!fs::PathExists(game_path))
@@ -42,10 +41,8 @@ SubgameSpec findSubgame(const std::string &id)
// Find addon directories
std::set<std::string> addon_paths;
if(!user_game)
- addon_paths.insert(share_server + DIR_DELIM + "addons"
- + DIR_DELIM + id);
- addon_paths.insert(user_server + DIR_DELIM + "addons"
- + DIR_DELIM + id);
+ addon_paths.insert(share + DIR_DELIM + "addons" + DIR_DELIM + id);
+ addon_paths.insert(user + DIR_DELIM + "addons" + DIR_DELIM + id);
// TODO: Read proper name from game_path/game.conf
std::string game_name = id;
return SubgameSpec(id, game_path, addon_paths, game_name);
@@ -55,10 +52,8 @@ std::set<std::string> getAvailableGameIds()
{
std::set<std::string> gameids;
std::set<std::string> gamespaths;
- gamespaths.insert(porting::path_share + DIR_DELIM + "server"
- + DIR_DELIM + "games");
- gamespaths.insert(porting::path_user + DIR_DELIM + "server"
- + DIR_DELIM + "games");
+ gamespaths.insert(porting::path_share + DIR_DELIM + "games");
+ gamespaths.insert(porting::path_user + DIR_DELIM + "games");
for(std::set<std::string>::const_iterator i = gamespaths.begin();
i != gamespaths.end(); i++){
std::vector<fs::DirListNode> dirlist = fs::GetDirListing(*i);
@@ -105,8 +100,7 @@ std::vector<WorldSpec> getAvailableWorlds()
{
std::vector<WorldSpec> worlds;
std::set<std::string> worldspaths;
- worldspaths.insert(porting::path_user + DIR_DELIM + "server"
- + DIR_DELIM + "worlds");
+ worldspaths.insert(porting::path_user + DIR_DELIM + "worlds");
infostream<<"Searching worlds..."<<std::endl;
for(std::set<std::string>::const_iterator i = worldspaths.begin();
i != worldspaths.end(); i++){