Browse Source

test

tags/v2.0.1
Mrchiantos 3 weeks ago
parent
commit
c174cb41e6

+ 1
- 1
.gitlab-ci.yml View File

@@ -17,7 +17,7 @@ variables:
- mkdir cmakebuild
- mkdir -p artifact/minetest/usr/
- cd cmakebuild
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
- make -j2
- make install
artifacts:

+ 1
- 1
build/WindowsApp/buildwin32.sh View File

@@ -81,7 +81,7 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=/tmp \
-DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
-DRUN_IN_PLACE=0 \
-DRUN_IN_PLACE=1 \
\
-DENABLE_SOUND=1 \
-DENABLE_CURL=1 \

+ 1
- 1
build/WindowsApp/buildwin64.sh View File

@@ -81,7 +81,7 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=/tmp \
-DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
-DRUN_IN_PLACE=0 \
-DRUN_IN_PLACE=1 \
\
-DENABLE_SOUND=1 \
-DENABLE_CURL=1 \

+ 2
- 2
build/iOS/MultiCraft/MultiCraft.xcodeproj/project.pbxproj View File

@@ -1940,7 +1940,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
__IOS__,
"RUN_IN_PLACE=0",
"RUN_IN_PLACE=1",
"USE_GETTEXT=1",
"USE_CURL=1",
"USE_SOUND=1",
@@ -2035,7 +2035,7 @@
"$(inherited)",
"NDEBUG=1",
__IOS__,
"RUN_IN_PLACE=0",
"RUN_IN_PLACE=1",
"USE_GETTEXT=1",
"USE_CURL=1",
"USE_SOUND=1",

+ 0
- 7
doc/client_lua_api.md View File

@@ -33,9 +33,6 @@ the `init.lua` scripts in a shared environment.
Paths
-----
* `RUN_IN_PLACE=1` (Windows release, local build)
* `$path_user`:
* Linux: `<build directory>`
* Windows: `<build directory>`
* `$path_share`
* Linux: `<build directory>`
* Windows: `<build directory>`
@@ -43,16 +40,12 @@ Paths
* `$path_share`
* Linux: `/usr/share/minetest`
* Windows: `<install directory>/minetest-0.4.x`
* `$path_user`:
* Linux: `$HOME/.minetest`
* Windows: `C:/users/<user>/AppData/minetest` (maybe)

Mod load path
-------------
Generic:

* `$path_share/clientmods/`
* `$path_user/clientmods/` (User-installed mods)

In a run-in-place version (e.g. the distributed windows version):


+ 1
- 14
doc/lua_api.txt View File

@@ -30,27 +30,16 @@ the `init.lua` scripts in a shared environment.

Paths
-----
* `RUN_IN_PLACE=1` (Windows release, local build)
* `$path_user`:
* Linux: `<build directory>`
* Windows: `<build directory>`
* `RUN_IN_PLACE=1`
* `$path_share`
* Linux: `<build directory>`
* Windows: `<build directory>`
* `RUN_IN_PLACE=0`: (Linux release)
* `$path_share`
* Linux: `/usr/share/minetest`
* Windows: `<install directory>/minetest-0.4.x`
* `$path_user`:
* Linux: `$HOME/.minetest`
* Windows: `C:/users/<user>/AppData/minetest` (maybe)

Games
-----
Games are looked up from:

* `$path_share/games/gameid/`
* `$path_user/games/gameid/`

where `gameid` is unique to each game.

@@ -86,8 +75,6 @@ Generic:

* `$path_share/games/gameid/mods/`
* `$path_share/mods/`
* `$path_user/games/gameid/mods/`
* `$path_user/mods/` (User-installed mods)
* `$worldpath/worldmods/`

In a run-in-place version (e.g. the distributed windows version):

+ 2
- 2
src/client.cpp View File

@@ -773,7 +773,7 @@ void Client::initLocalMapSaving(const Address &address,
}

#ifdef _WIN32
const std::string world_path = porting::path_user
const std::string world_path = porting::path_share
+ DIR_DELIM + "worlds"
+ DIR_DELIM + "server_"
+ hostname + "_" + std::to_string(address.getPort());
@@ -1981,5 +1981,5 @@ void Client::unregisterModStorage(const std::string &name)

std::string Client::getModStoragePath() const
{
return porting::path_user + DIR_DELIM + "client" + DIR_DELIM + "mod_storage";
return porting::path_share + DIR_DELIM + "client" + DIR_DELIM + "mod_storage";
}

+ 1
- 1
src/client/clientlauncher.cpp View File

@@ -598,7 +598,7 @@ bool ClientLauncher::create_engine_device()
params.ZBufferBits = 24;
#ifdef __ANDROID__
params.PrivateData = porting::app_global;
params.OGLES2ShaderPath = std::string(porting::path_user + DIR_DELIM +
params.OGLES2ShaderPath = std::string(porting::path_share + DIR_DELIM +
"media" + DIR_DELIM + "Shaders" + DIR_DELIM).c_str();
#endif


+ 1
- 1
src/debug.cpp View File

@@ -294,7 +294,7 @@ long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo)
MINIDUMP_USER_STREAM mdus;
bool minidump_created = false;

std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME ".dmp";
std::string dumpfile = porting::path_share + DIR_DELIM PROJECT_NAME ".dmp";

std::string version_str(PROJECT_NAME " ");
version_str += g_version_hash;

+ 0
- 1
src/game.cpp View File

@@ -607,7 +607,6 @@ public:
m_fetched.insert(name);

paths_insert(dst_paths, porting::path_share, name);
paths_insert(dst_paths, porting::path_user, name);
}
};


+ 1
- 1
src/guiEngine.cpp View File

@@ -128,7 +128,7 @@ void MenuMusicFetcher::fetchSounds(const std::string &name,
int i;
for(i=0; i<10; i++)
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");
base = porting::path_user + DIR_DELIM + "sounds";
base = porting::path_share + DIR_DELIM + "sounds";
dst_paths.insert(base + DIR_DELIM + name + ".ogg");
for(i=0; i<10; i++)
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");

+ 7
- 7
src/main.cpp View File

@@ -420,11 +420,11 @@ static void setup_log_params(const Settings &cmd_args)
static bool create_userdata_path()
{
#if defined(__ANDROID__) || defined(__IOS__)
if (fs::PathExists(porting::path_user))
if (fs::PathExists(porting::path_share))
return true;
#endif
// Create user data directory
return fs::CreateDir(porting::path_user);
return fs::CreateDir(porting::path_share);
}

static bool init_common(const Settings &cmd_args, int argc, char *argv[])
@@ -477,15 +477,15 @@ static bool read_config_file(const Settings &cmd_args)
g_settings_path = cmd_args.get("config");
} else {
std::vector<std::string> filenames;
filenames.push_back(porting::path_user + DIR_DELIM + "blockcolor.conf");
filenames.push_back(porting::path_share + DIR_DELIM + "blockcolor.conf");
// Legacy configuration file location
filenames.push_back(porting::path_user +
filenames.push_back(porting::path_share +
DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");

#if RUN_IN_PLACE
// Try also from a lower level (to aid having the same configuration
// for many RUN_IN_PLACE installs)
filenames.push_back(porting::path_user +
filenames.push_back(porting::path_share +
DIR_DELIM + ".." + DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");
#endif

@@ -510,7 +510,7 @@ static void init_log_streams(const Settings &cmd_args)
#if RUN_IN_PLACE
std::string log_filename = DEBUGFILE;
#else
std::string log_filename = porting::path_user + DIR_DELIM + DEBUGFILE;
std::string log_filename = porting::path_share + DIR_DELIM + DEBUGFILE;
#endif
if (cmd_args.exists("logfile"))
log_filename = cmd_args.get("logfile");
@@ -667,7 +667,7 @@ static bool auto_select_world(GameParams *game_params)
// If there are no worlds, automatically create a new one
} else {
// This is the ultimate default world path
world_path = porting::path_user + DIR_DELIM + "worlds" +
world_path = porting::path_share + DIR_DELIM + "worlds" +
DIR_DELIM + "world";
infostream << "Creating default world at ["
<< world_path << "]" << std::endl;

+ 3
- 3
src/mods.cpp View File

@@ -355,11 +355,11 @@ ClientModConfiguration::ClientModConfiguration(const std::string &path):
ModConfiguration(path)
{
std::set<std::string> paths;
std::string path_user = porting::path_user + DIR_DELIM + "clientmods";
std::string path_share = porting::path_share + DIR_DELIM + "clientmods";
paths.insert(path);
paths.insert(path_user);
paths.insert(path_share);

std::string settings_path = path_user + DIR_DELIM + "mods.conf";
std::string settings_path = path_share + DIR_DELIM + "mods.conf";
addModsFormConfig(settings_path, paths);
}
#endif

+ 8
- 18
src/porting.cpp View File

@@ -145,9 +145,8 @@ void signal_handler_init(void)

// Default to RUN_IN_PLACE style relative paths
std::string path_share = "..";
std::string path_user = "..";
std::string path_locale = path_share + DIR_DELIM + "locale";
std::string path_cache = path_user + DIR_DELIM + "cache";
std::string path_cache = path_share + DIR_DELIM + "cache";


std::string getDataPath(const char *subpath)
@@ -379,7 +378,6 @@ bool setSystemPaths()
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");

path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME;
return true;
}

@@ -415,7 +413,7 @@ bool setSystemPaths()
trylist.push_back(bindir + DIR_DELIM "..");

#ifdef __ANDROID__
trylist.push_back(path_user);
trylist.push_back(path_share);
#endif

for (std::list<std::string>::const_iterator
@@ -439,8 +437,7 @@ bool setSystemPaths()
}

#ifndef __ANDROID__
path_user = std::string(getenv("HOME")) + DIR_DELIM "."
+ PROJECT_NAME;

#endif

return true;
@@ -463,9 +460,7 @@ bool setSystemPaths()
}
CFRelease(resources_url);

path_user = std::string(getenv("HOME"))
+ "/Library/Application Support/"
+ PROJECT_NAME;

return true;
}

@@ -475,8 +470,7 @@ bool setSystemPaths()
bool setSystemPaths()
{
path_share = STATIC_SHAREDIR;
path_user = std::string(getenv("HOME")) + DIR_DELIM "."
+ lowercase(PROJECT_NAME);

return true;
}

@@ -499,11 +493,9 @@ void initializePaths()
std::string execpath(buf);

path_share = execpath + DIR_DELIM "..";
path_user = execpath + DIR_DELIM "..";

if (detectMSVCBuildDir(execpath)) {
path_share += DIR_DELIM "..";
path_user += DIR_DELIM "..";
}
} else {
errorstream << "Failed to get paths by executable location, "
@@ -524,9 +516,8 @@ void initializePaths()
std::string execpath(buf);

path_share = execpath;
path_user = execpath;
}
path_cache = path_user + DIR_DELIM + "cache";
path_cache = path_share + DIR_DELIM + "cache";
#else
infostream << "Using system-wide paths (NOT RUN_IN_PLACE)" << std::endl;

@@ -544,13 +535,12 @@ void initializePaths()
path_cache = std::string(home_dir) + DIR_DELIM + ".cache"
+ DIR_DELIM + PROJECT_NAME;
} else {
// If neither works, use $PATH_USER/cache
path_cache = path_user + DIR_DELIM + "cache";
// If neither works, use $PATH_SHARE/cache
path_cache = path_share + DIR_DELIM + "cache";
}
#endif

infostream << "Detected share path: " << path_share << std::endl;
infostream << "Detected user path: " << path_user << std::endl;
infostream << "Detected cache path: " << path_cache << std::endl;

#ifdef USE_GETTEXT

+ 0
- 1
src/porting.h View File

@@ -144,7 +144,6 @@ extern std::string path_share;
Linux: "~/.<PROJECT_NAME>"
Mac: "~/Library/Application Support/<PROJECT_NAME>"
*/
extern std::string path_user;

/*
Path to gettext locale files

+ 3
- 4
src/porting_android.cpp View File

@@ -145,7 +145,7 @@ void cleanupAndroid()

#ifdef GPROF
errorstream << "Shutting down GPROF profiler" << std::endl;
setenv("CPUPROFILE", (path_user + DIR_DELIM + "gmon.out").c_str(), 1);
setenv("CPUPROFILE", (path_share + DIR_DELIM + "gmon.out").c_str(), 1);
moncleanup();
#endif

@@ -206,9 +206,8 @@ void initializePathsAndroid()
cls_File, mt_getAbsPath, "getCacheDir");
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
"getExternalStorageDirectory");
path_user = path_storage + DIR_DELIM + "Android/data/net.blockcolor.game/files";
path_share = path_user;
path_locale = path_user + DIR_DELIM + "locale";
path_share = path_storage + DIR_DELIM + "Android/data/net.blockcolor.game/files";
path_locale = path_share + DIR_DELIM + "locale";
}

void showInputDialog(const std::string& acceptButton, const std::string& hint,

+ 0
- 2
src/porting_ios.cpp View File

@@ -31,8 +31,6 @@ namespace porting {
void initializePathsiOS() {
char buf[128];

ioswrap_paths(PATH_DOCUMENTS, buf, sizeof(buf));
path_user = std::string(buf);
ioswrap_paths(PATH_LIBRARY_SUPPORT, buf, sizeof(buf));
path_share = std::string(buf);
path_locale = std::string(buf) + "/locale";

+ 6
- 6
src/script/lua_api/l_mainmenu.cpp View File

@@ -667,7 +667,7 @@ int ModApiMainMenu::l_create_world(lua_State *L)
const char *name = luaL_checkstring(L, 1);
int gameidx = luaL_checkinteger(L,2) -1;

std::string path = porting::path_user + DIR_DELIM
std::string path = porting::path_share + DIR_DELIM
"worlds" + DIR_DELIM
+ name;

@@ -753,7 +753,7 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L)
int ModApiMainMenu::l_get_modpath(lua_State *L)
{
std::string modpath = fs::RemoveRelativePathComponents(
porting::path_user + DIR_DELIM + "mods" + DIR_DELIM);
porting::path_share + DIR_DELIM + "mods" + DIR_DELIM);
lua_pushstring(L, modpath.c_str());
return 1;
}
@@ -762,7 +762,7 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
int ModApiMainMenu::l_get_gamepath(lua_State *L)
{
std::string gamepath = fs::RemoveRelativePathComponents(
porting::path_user + DIR_DELIM + "games" + DIR_DELIM);
porting::path_share + DIR_DELIM + "games" + DIR_DELIM);
lua_pushstring(L, gamepath.c_str());
return 1;
}
@@ -771,7 +771,7 @@ int ModApiMainMenu::l_get_gamepath(lua_State *L)
int ModApiMainMenu::l_get_texturepath(lua_State *L)
{
std::string gamepath = fs::RemoveRelativePathComponents(
porting::path_user + DIR_DELIM + "textures");
porting::path_share + DIR_DELIM + "textures");
lua_pushstring(L, gamepath.c_str());
return 1;
}
@@ -953,11 +953,11 @@ bool ModApiMainMenu::isMinetestPath(std::string path)
return true;

/* mods */
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "files")))
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "files")))
return true;

/* worlds */
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "worlds")))
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "worlds")))
return true;



+ 1
- 1
src/server.cpp View File

@@ -2371,7 +2371,7 @@ void Server::fillMediaCache()
paths.push_back(mod.path + DIR_DELIM + "media");
paths.push_back(mod.path + DIR_DELIM + "models");
}
paths.push_back(porting::path_user + DIR_DELIM + "textures" + DIR_DELIM + "server");
paths.push_back(porting::path_share + DIR_DELIM + "textures" + DIR_DELIM + "server");

// Collect media file information from paths into cache
for(std::vector<std::string>::iterator i = paths.begin();

+ 3
- 3
src/serverlist.cpp View File

@@ -42,9 +42,9 @@ std::string getFilePath()
std::string serverlist_file = g_settings->get("serverlist_file");

std::string dir_path = "client" DIR_DELIM "serverlist" DIR_DELIM;
fs::CreateDir(porting::path_user + DIR_DELIM "client");
fs::CreateDir(porting::path_user + DIR_DELIM + dir_path);
return porting::path_user + DIR_DELIM + dir_path + serverlist_file;
fs::CreateDir(porting::path_share + DIR_DELIM "client");
fs::CreateDir(porting::path_share + DIR_DELIM + dir_path);
return porting::path_share + DIR_DELIM + dir_path + serverlist_file;
}



+ 2
- 4
src/subgame.cpp View File

@@ -74,7 +74,6 @@ SubgameSpec findSubgame(const std::string &id)
if(id == "")
return SubgameSpec();
std::string share = porting::path_share;
std::string user = porting::path_user;
std::vector<GameFindPath> find_paths;

Strfnd search_paths(getSubgamePathEnv());
@@ -149,7 +148,6 @@ std::set<std::string> getAvailableGameIds()
std::set<std::string> gameids;
std::set<std::string> gamespaths;
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
gamespaths.insert(porting::path_user + DIR_DELIM + "games");

Strfnd search_paths(getSubgamePathEnv());

@@ -233,7 +231,7 @@ std::vector<WorldSpec> getAvailableWorlds()
while (!search_paths.at_end())
worldspaths.insert(search_paths.next(PATH_DELIM));

worldspaths.insert(porting::path_user + DIR_DELIM + "worlds");
worldspaths.insert(porting::path_share + DIR_DELIM + "worlds");
infostream << "Searching worlds..." << std::endl;
for (std::set<std::string>::const_iterator i = worldspaths.begin();
i != worldspaths.end(); ++i) {
@@ -259,7 +257,7 @@ std::vector<WorldSpec> getAvailableWorlds()
}
// Check old world location
do{
std::string fullpath = porting::path_user + DIR_DELIM + "world";
std::string fullpath = porting::path_share + DIR_DELIM + "world";
if(!fs::PathExists(fullpath))
break;
std::string name = "Old World";

Loading…
Cancel
Save