Fix
This commit is contained in:
parent
7bb155ac9e
commit
de123125ce
|
@ -13,8 +13,8 @@ set(PROJECT_NAME_CAPITALIZED "BlockColor")
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
|
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
|
||||||
set(VERSION_MAJOR 1)
|
set(VERSION_MAJOR 2)
|
||||||
set(VERSION_MINOR 3)
|
set(VERSION_MINOR 0)
|
||||||
set(VERSION_PATCH 0)
|
set(VERSION_PATCH 0)
|
||||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/worlds" DESTINATION "${SHAREDIR}")
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
||||||
|
@ -172,7 +173,7 @@ install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}")
|
||||||
install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}")
|
||||||
install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}")
|
||||||
install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}")
|
||||||
install(FILES "blockcolor.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
install(FILES "blockcolor.conf" DESTINATION "${EXAMPLE_CONF_DIR}")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(FILES "doc/BlockColor.6" "doc/BlockColorServer.6" DESTINATION "${MANDIR}/man6")
|
install(FILES "doc/BlockColor.6" "doc/BlockColorServer.6" DESTINATION "${MANDIR}/man6")
|
||||||
|
|
|
@ -598,7 +598,7 @@ $(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB)
|
||||||
touch ${IRRLICHT_DIR}/media/timestamp; \
|
touch ${IRRLICHT_DIR}/media/timestamp; \
|
||||||
touch ${ASSETS_TIMESTAMP}; \
|
touch ${ASSETS_TIMESTAMP}; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ ${PROJ_ROOT}/blockcolor.conf.example -nt ${ASSETS_TIMESTAMP} ] ; then \
|
if [ ${PROJ_ROOT}/blockcolor.conf -nt ${ASSETS_TIMESTAMP} ] ; then \
|
||||||
echo "conf changed"; \
|
echo "conf changed"; \
|
||||||
touch ${ASSETS_TIMESTAMP}; \
|
touch ${ASSETS_TIMESTAMP}; \
|
||||||
fi; \
|
fi; \
|
||||||
|
|
|
@ -33,7 +33,7 @@ the `init.lua` scripts in a shared environment.
|
||||||
Paths
|
Paths
|
||||||
-----
|
-----
|
||||||
* `RUN_IN_PLACE=1` (Windows release, local build)
|
* `RUN_IN_PLACE=1` (Windows release, local build)
|
||||||
* `$path_share`:
|
* `$path_user`:
|
||||||
* Linux: `<build directory>`
|
* Linux: `<build directory>`
|
||||||
* Windows: `<build directory>`
|
* Windows: `<build directory>`
|
||||||
* `$path_share`
|
* `$path_share`
|
||||||
|
@ -43,7 +43,7 @@ Paths
|
||||||
* `$path_share`
|
* `$path_share`
|
||||||
* Linux: `/usr/share/minetest`
|
* Linux: `/usr/share/minetest`
|
||||||
* Windows: `<install directory>/minetest-0.4.x`
|
* Windows: `<install directory>/minetest-0.4.x`
|
||||||
* `$path_share`:
|
* `$path_user`:
|
||||||
* Linux: `$HOME/.minetest`
|
* Linux: `$HOME/.minetest`
|
||||||
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
|
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Mod load path
|
||||||
Generic:
|
Generic:
|
||||||
|
|
||||||
* `$path_share/clientmods/`
|
* `$path_share/clientmods/`
|
||||||
* `$path_share/clientmods/` (User-installed mods)
|
* `$path_user/clientmods/` (User-installed mods)
|
||||||
|
|
||||||
In a run-in-place version (e.g. the distributed windows version):
|
In a run-in-place version (e.g. the distributed windows version):
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ the `init.lua` scripts in a shared environment.
|
||||||
Paths
|
Paths
|
||||||
-----
|
-----
|
||||||
* `RUN_IN_PLACE=1` (Windows release, local build)
|
* `RUN_IN_PLACE=1` (Windows release, local build)
|
||||||
* `$path_share`:
|
* `$path_user`:
|
||||||
* Linux: `<build directory>`
|
* Linux: `<build directory>`
|
||||||
* Windows: `<build directory>`
|
* Windows: `<build directory>`
|
||||||
* `$path_share`
|
* `$path_share`
|
||||||
|
@ -41,7 +41,7 @@ Paths
|
||||||
* `$path_share`
|
* `$path_share`
|
||||||
* Linux: `/usr/share/minetest`
|
* Linux: `/usr/share/minetest`
|
||||||
* Windows: `<install directory>/minetest-0.4.x`
|
* Windows: `<install directory>/minetest-0.4.x`
|
||||||
* `$path_share`:
|
* `$path_user`:
|
||||||
* Linux: `$HOME/.minetest`
|
* Linux: `$HOME/.minetest`
|
||||||
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
|
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ Games
|
||||||
Games are looked up from:
|
Games are looked up from:
|
||||||
|
|
||||||
* `$path_share/games/gameid/`
|
* `$path_share/games/gameid/`
|
||||||
* `$path_share/games/gameid/`
|
* `$path_user/games/gameid/`
|
||||||
|
|
||||||
where `gameid` is unique to each game.
|
where `gameid` is unique to each game.
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ Generic:
|
||||||
|
|
||||||
* `$path_share/games/gameid/mods/`
|
* `$path_share/games/gameid/mods/`
|
||||||
* `$path_share/mods/`
|
* `$path_share/mods/`
|
||||||
* `$path_share/games/gameid/mods/`
|
* `$path_user/games/gameid/mods/`
|
||||||
* `$path_share/mods/` (User-installed mods)
|
* `$path_user/mods/` (User-installed mods)
|
||||||
* `$worldpath/worldmods/`
|
* `$worldpath/worldmods/`
|
||||||
|
|
||||||
In a run-in-place version (e.g. the distributed windows version):
|
In a run-in-place version (e.g. the distributed windows version):
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#if RUN_IN_PLACE
|
#if RUN_IN_PLACE
|
||||||
#define BUILDMODE "RUN_IN_PLACE=1"
|
#define BUILDMODE "RUN_IN_PLACE=1"
|
||||||
#else
|
#else
|
||||||
#define BUILDMODE "RUN_IN_PLACE=0"
|
#define BUILDMODE "RUN_IN_PLACE=1"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LANGUAGE 0, SUBLANG_NEUTRAL
|
LANGUAGE 0, SUBLANG_NEUTRAL
|
||||||
|
|
|
@ -773,7 +773,7 @@ void Client::initLocalMapSaving(const Address &address,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const std::string world_path = porting::path_share
|
const std::string world_path = porting::path_user
|
||||||
+ DIR_DELIM + "worlds"
|
+ DIR_DELIM + "worlds"
|
||||||
+ DIR_DELIM + "server_"
|
+ DIR_DELIM + "server_"
|
||||||
+ hostname + "_" + std::to_string(address.getPort());
|
+ hostname + "_" + std::to_string(address.getPort());
|
||||||
|
@ -1981,5 +1981,5 @@ void Client::unregisterModStorage(const std::string &name)
|
||||||
|
|
||||||
std::string Client::getModStoragePath() const
|
std::string Client::getModStoragePath() const
|
||||||
{
|
{
|
||||||
return porting::path_share + DIR_DELIM + "client" + DIR_DELIM + "mod_storage";
|
return porting::path_user + DIR_DELIM + "client" + DIR_DELIM + "mod_storage";
|
||||||
}
|
}
|
||||||
|
|
|
@ -598,7 +598,7 @@ bool ClientLauncher::create_engine_device()
|
||||||
params.ZBufferBits = 24;
|
params.ZBufferBits = 24;
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
params.PrivateData = porting::app_global;
|
params.PrivateData = porting::app_global;
|
||||||
params.OGLES2ShaderPath = std::string(porting::path_share + DIR_DELIM +
|
params.OGLES2ShaderPath = std::string(porting::path_user + DIR_DELIM +
|
||||||
"media" + DIR_DELIM + "Shaders" + DIR_DELIM).c_str();
|
"media" + DIR_DELIM + "Shaders" + DIR_DELIM).c_str();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#define PROJECT_NAME "BlockColor"
|
#define PROJECT_NAME "BlockColor"
|
||||||
#define PROJECT_NAME_C "BlockColor"
|
#define PROJECT_NAME_C "BlockColor"
|
||||||
#define STATIC_SHAREDIR ""
|
#define STATIC_SHAREDIR ""
|
||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH)
|
#define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -294,7 +294,7 @@ long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo)
|
||||||
MINIDUMP_USER_STREAM mdus;
|
MINIDUMP_USER_STREAM mdus;
|
||||||
bool minidump_created = false;
|
bool minidump_created = false;
|
||||||
|
|
||||||
std::string dumpfile = porting::path_share + DIR_DELIM PROJECT_NAME ".dmp";
|
std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME ".dmp";
|
||||||
|
|
||||||
std::string version_str(PROJECT_NAME " ");
|
std::string version_str(PROJECT_NAME " ");
|
||||||
version_str += g_version_hash;
|
version_str += g_version_hash;
|
||||||
|
|
|
@ -607,7 +607,7 @@ public:
|
||||||
m_fetched.insert(name);
|
m_fetched.insert(name);
|
||||||
|
|
||||||
paths_insert(dst_paths, porting::path_share, name);
|
paths_insert(dst_paths, porting::path_share, name);
|
||||||
paths_insert(dst_paths, porting::path_share, name);
|
paths_insert(dst_paths, porting::path_user, name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void MenuMusicFetcher::fetchSounds(const std::string &name,
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<10; i++)
|
for(i=0; i<10; i++)
|
||||||
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");
|
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");
|
||||||
base = porting::path_share + DIR_DELIM + "sounds";
|
base = porting::path_user + DIR_DELIM + "sounds";
|
||||||
dst_paths.insert(base + DIR_DELIM + name + ".ogg");
|
dst_paths.insert(base + DIR_DELIM + name + ".ogg");
|
||||||
for(i=0; i<10; i++)
|
for(i=0; i<10; i++)
|
||||||
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");
|
dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg");
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -420,11 +420,11 @@ static void setup_log_params(const Settings &cmd_args)
|
||||||
static bool create_userdata_path()
|
static bool create_userdata_path()
|
||||||
{
|
{
|
||||||
#if defined(__ANDROID__) || defined(__IOS__)
|
#if defined(__ANDROID__) || defined(__IOS__)
|
||||||
if (fs::PathExists(porting::path_share))
|
if (fs::PathExists(porting::path_user))
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
// Create user data directory
|
// Create user data directory
|
||||||
return fs::CreateDir(porting::path_share);
|
return fs::CreateDir(porting::path_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool init_common(const Settings &cmd_args, int argc, char *argv[])
|
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");
|
g_settings_path = cmd_args.get("config");
|
||||||
} else {
|
} else {
|
||||||
std::vector<std::string> filenames;
|
std::vector<std::string> filenames;
|
||||||
filenames.push_back(porting::path_share + DIR_DELIM + "blockcolor.conf");
|
filenames.push_back(porting::path_user + DIR_DELIM + "blockcolor.conf");
|
||||||
// Legacy configuration file location
|
// Legacy configuration file location
|
||||||
filenames.push_back(porting::path_share +
|
filenames.push_back(porting::path_user +
|
||||||
DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");
|
DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");
|
||||||
|
|
||||||
#if RUN_IN_PLACE
|
#if RUN_IN_PLACE
|
||||||
// Try also from a lower level (to aid having the same configuration
|
// Try also from a lower level (to aid having the same configuration
|
||||||
// for many RUN_IN_PLACE installs)
|
// for many RUN_IN_PLACE installs)
|
||||||
filenames.push_back(porting::path_share +
|
filenames.push_back(porting::path_user +
|
||||||
DIR_DELIM + ".." + DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");
|
DIR_DELIM + ".." + DIR_DELIM + ".." + DIR_DELIM + "blockcolor.conf");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ static void init_log_streams(const Settings &cmd_args)
|
||||||
#if RUN_IN_PLACE
|
#if RUN_IN_PLACE
|
||||||
std::string log_filename = DEBUGFILE;
|
std::string log_filename = DEBUGFILE;
|
||||||
#else
|
#else
|
||||||
std::string log_filename = porting::path_share + DIR_DELIM + DEBUGFILE;
|
std::string log_filename = porting::path_user + DIR_DELIM + DEBUGFILE;
|
||||||
#endif
|
#endif
|
||||||
if (cmd_args.exists("logfile"))
|
if (cmd_args.exists("logfile"))
|
||||||
log_filename = cmd_args.get("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
|
// If there are no worlds, automatically create a new one
|
||||||
} else {
|
} else {
|
||||||
// This is the ultimate default world path
|
// This is the ultimate default world path
|
||||||
world_path = porting::path_share + DIR_DELIM + "worlds" +
|
world_path = porting::path_user + DIR_DELIM + "worlds" +
|
||||||
DIR_DELIM + "world";
|
DIR_DELIM + "world";
|
||||||
infostream << "Creating default world at ["
|
infostream << "Creating default world at ["
|
||||||
<< world_path << "]" << std::endl;
|
<< world_path << "]" << std::endl;
|
||||||
|
|
|
@ -355,11 +355,11 @@ ClientModConfiguration::ClientModConfiguration(const std::string &path):
|
||||||
ModConfiguration(path)
|
ModConfiguration(path)
|
||||||
{
|
{
|
||||||
std::set<std::string> paths;
|
std::set<std::string> paths;
|
||||||
std::string path_share = porting::path_share + DIR_DELIM + "clientmods";
|
std::string path_user = porting::path_user + DIR_DELIM + "clientmods";
|
||||||
paths.insert(path);
|
paths.insert(path);
|
||||||
paths.insert(path_share);
|
paths.insert(path_user);
|
||||||
|
|
||||||
std::string settings_path = path_share + DIR_DELIM + "mods.conf";
|
std::string settings_path = path_user + DIR_DELIM + "mods.conf";
|
||||||
addModsFormConfig(settings_path, paths);
|
addModsFormConfig(settings_path, paths);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -145,8 +145,9 @@ void signal_handler_init(void)
|
||||||
|
|
||||||
// Default to RUN_IN_PLACE style relative paths
|
// Default to RUN_IN_PLACE style relative paths
|
||||||
std::string path_share = "..";
|
std::string path_share = "..";
|
||||||
|
std::string path_user = "..";
|
||||||
std::string path_locale = path_share + DIR_DELIM + "locale";
|
std::string path_locale = path_share + DIR_DELIM + "locale";
|
||||||
std::string path_cache = path_share + DIR_DELIM + "cache";
|
std::string path_cache = path_user + DIR_DELIM + "cache";
|
||||||
|
|
||||||
|
|
||||||
std::string getDataPath(const char *subpath)
|
std::string getDataPath(const char *subpath)
|
||||||
|
@ -378,7 +379,7 @@ bool setSystemPaths()
|
||||||
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
|
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
|
||||||
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");
|
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");
|
||||||
|
|
||||||
path_share = std::string(buf) + DIR_DELIM + PROJECT_NAME;
|
path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +415,7 @@ bool setSystemPaths()
|
||||||
trylist.push_back(bindir + DIR_DELIM "..");
|
trylist.push_back(bindir + DIR_DELIM "..");
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
trylist.push_back(path_share);
|
trylist.push_back(path_user);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (std::list<std::string>::const_iterator
|
for (std::list<std::string>::const_iterator
|
||||||
|
@ -438,7 +439,7 @@ bool setSystemPaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
path_share = std::string(getenv("HOME")) + DIR_DELIM "."
|
path_user = std::string(getenv("HOME")) + DIR_DELIM "."
|
||||||
+ PROJECT_NAME;
|
+ PROJECT_NAME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -462,7 +463,7 @@ bool setSystemPaths()
|
||||||
}
|
}
|
||||||
CFRelease(resources_url);
|
CFRelease(resources_url);
|
||||||
|
|
||||||
path_share = std::string(getenv("HOME"))
|
path_user = std::string(getenv("HOME"))
|
||||||
+ "/Library/Application Support/"
|
+ "/Library/Application Support/"
|
||||||
+ PROJECT_NAME;
|
+ PROJECT_NAME;
|
||||||
return true;
|
return true;
|
||||||
|
@ -474,7 +475,7 @@ bool setSystemPaths()
|
||||||
bool setSystemPaths()
|
bool setSystemPaths()
|
||||||
{
|
{
|
||||||
path_share = STATIC_SHAREDIR;
|
path_share = STATIC_SHAREDIR;
|
||||||
path_share = std::string(getenv("HOME")) + DIR_DELIM "."
|
path_user = std::string(getenv("HOME")) + DIR_DELIM "."
|
||||||
+ lowercase(PROJECT_NAME);
|
+ lowercase(PROJECT_NAME);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -498,11 +499,11 @@ void initializePaths()
|
||||||
std::string execpath(buf);
|
std::string execpath(buf);
|
||||||
|
|
||||||
path_share = execpath + DIR_DELIM "..";
|
path_share = execpath + DIR_DELIM "..";
|
||||||
path_share = execpath + DIR_DELIM "..";
|
path_user = execpath + DIR_DELIM "..";
|
||||||
|
|
||||||
if (detectMSVCBuildDir(execpath)) {
|
if (detectMSVCBuildDir(execpath)) {
|
||||||
path_share += DIR_DELIM "..";
|
path_share += DIR_DELIM "..";
|
||||||
path_share += DIR_DELIM "..";
|
path_user += DIR_DELIM "..";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorstream << "Failed to get paths by executable location, "
|
errorstream << "Failed to get paths by executable location, "
|
||||||
|
@ -523,9 +524,9 @@ void initializePaths()
|
||||||
std::string execpath(buf);
|
std::string execpath(buf);
|
||||||
|
|
||||||
path_share = execpath;
|
path_share = execpath;
|
||||||
path_share = execpath;
|
path_user = execpath;
|
||||||
}
|
}
|
||||||
path_cache = path_share + DIR_DELIM + "cache";
|
path_cache = path_user + DIR_DELIM + "cache";
|
||||||
#else
|
#else
|
||||||
infostream << "Using system-wide paths (NOT RUN_IN_PLACE)" << std::endl;
|
infostream << "Using system-wide paths (NOT RUN_IN_PLACE)" << std::endl;
|
||||||
|
|
||||||
|
@ -543,13 +544,13 @@ void initializePaths()
|
||||||
path_cache = std::string(home_dir) + DIR_DELIM + ".cache"
|
path_cache = std::string(home_dir) + DIR_DELIM + ".cache"
|
||||||
+ DIR_DELIM + PROJECT_NAME;
|
+ DIR_DELIM + PROJECT_NAME;
|
||||||
} else {
|
} else {
|
||||||
// If neither works, use $path_share/cache
|
// If neither works, use $PATH_USER/cache
|
||||||
path_cache = path_share + DIR_DELIM + "cache";
|
path_cache = path_user + DIR_DELIM + "cache";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
infostream << "Detected share path: " << path_share << std::endl;
|
infostream << "Detected share path: " << path_share << std::endl;
|
||||||
infostream << "Detected user path: " << path_share << std::endl;
|
infostream << "Detected user path: " << path_user << std::endl;
|
||||||
infostream << "Detected cache path: " << path_cache << std::endl;
|
infostream << "Detected cache path: " << path_cache << std::endl;
|
||||||
|
|
||||||
#ifdef USE_GETTEXT
|
#ifdef USE_GETTEXT
|
||||||
|
|
|
@ -144,6 +144,7 @@ extern std::string path_share;
|
||||||
Linux: "~/.<PROJECT_NAME>"
|
Linux: "~/.<PROJECT_NAME>"
|
||||||
Mac: "~/Library/Application Support/<PROJECT_NAME>"
|
Mac: "~/Library/Application Support/<PROJECT_NAME>"
|
||||||
*/
|
*/
|
||||||
|
extern std::string path_user;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Path to gettext locale files
|
Path to gettext locale files
|
||||||
|
|
|
@ -145,7 +145,7 @@ void cleanupAndroid()
|
||||||
|
|
||||||
#ifdef GPROF
|
#ifdef GPROF
|
||||||
errorstream << "Shutting down GPROF profiler" << std::endl;
|
errorstream << "Shutting down GPROF profiler" << std::endl;
|
||||||
setenv("CPUPROFILE", (path_share + DIR_DELIM + "gmon.out").c_str(), 1);
|
setenv("CPUPROFILE", (path_user + DIR_DELIM + "gmon.out").c_str(), 1);
|
||||||
moncleanup();
|
moncleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -206,9 +206,9 @@ void initializePathsAndroid()
|
||||||
cls_File, mt_getAbsPath, "getCacheDir");
|
cls_File, mt_getAbsPath, "getCacheDir");
|
||||||
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
|
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
|
||||||
"getExternalStorageDirectory");
|
"getExternalStorageDirectory");
|
||||||
path_share = path_storage + DIR_DELIM + "Android/data/net.blockcolor.game/files";
|
path_user = path_storage + DIR_DELIM + "Android/data/net.blockcolor.game/files";
|
||||||
path_share = path_share;
|
path_share = path_user;
|
||||||
path_locale = path_share + DIR_DELIM + "locale";
|
path_locale = path_user + DIR_DELIM + "locale";
|
||||||
}
|
}
|
||||||
|
|
||||||
void showInputDialog(const std::string& acceptButton, const std::string& hint,
|
void showInputDialog(const std::string& acceptButton, const std::string& hint,
|
||||||
|
|
|
@ -32,8 +32,9 @@ namespace porting {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
ioswrap_paths(PATH_DOCUMENTS, buf, sizeof(buf));
|
ioswrap_paths(PATH_DOCUMENTS, buf, sizeof(buf));
|
||||||
path_share = std::string(buf);
|
path_user = std::string(buf);
|
||||||
ioswrap_paths(PATH_LIBRARY_SUPPORT, buf, sizeof(buf));
|
ioswrap_paths(PATH_LIBRARY_SUPPORT, buf, sizeof(buf));
|
||||||
|
path_share = std::string(buf);
|
||||||
path_locale = std::string(buf) + "/locale";
|
path_locale = std::string(buf) + "/locale";
|
||||||
ioswrap_paths(PATH_LIBRARY_CACHE, buf, sizeof(buf));
|
ioswrap_paths(PATH_LIBRARY_CACHE, buf, sizeof(buf));
|
||||||
path_cache = std::string(buf);
|
path_cache = std::string(buf);
|
||||||
|
|
|
@ -667,7 +667,7 @@ int ModApiMainMenu::l_create_world(lua_State *L)
|
||||||
const char *name = luaL_checkstring(L, 1);
|
const char *name = luaL_checkstring(L, 1);
|
||||||
int gameidx = luaL_checkinteger(L,2) -1;
|
int gameidx = luaL_checkinteger(L,2) -1;
|
||||||
|
|
||||||
std::string path = porting::path_share + DIR_DELIM
|
std::string path = porting::path_user + DIR_DELIM
|
||||||
"worlds" + DIR_DELIM
|
"worlds" + DIR_DELIM
|
||||||
+ name;
|
+ name;
|
||||||
|
|
||||||
|
@ -753,7 +753,7 @@ int ModApiMainMenu::l_get_mapgen_names(lua_State *L)
|
||||||
int ModApiMainMenu::l_get_modpath(lua_State *L)
|
int ModApiMainMenu::l_get_modpath(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string modpath = fs::RemoveRelativePathComponents(
|
std::string modpath = fs::RemoveRelativePathComponents(
|
||||||
porting::path_share + DIR_DELIM + "mods" + DIR_DELIM);
|
porting::path_user + DIR_DELIM + "mods" + DIR_DELIM);
|
||||||
lua_pushstring(L, modpath.c_str());
|
lua_pushstring(L, modpath.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
|
||||||
int ModApiMainMenu::l_get_gamepath(lua_State *L)
|
int ModApiMainMenu::l_get_gamepath(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string gamepath = fs::RemoveRelativePathComponents(
|
std::string gamepath = fs::RemoveRelativePathComponents(
|
||||||
porting::path_share + DIR_DELIM + "games" + DIR_DELIM);
|
porting::path_user + DIR_DELIM + "games" + DIR_DELIM);
|
||||||
lua_pushstring(L, gamepath.c_str());
|
lua_pushstring(L, gamepath.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ int ModApiMainMenu::l_get_gamepath(lua_State *L)
|
||||||
int ModApiMainMenu::l_get_texturepath(lua_State *L)
|
int ModApiMainMenu::l_get_texturepath(lua_State *L)
|
||||||
{
|
{
|
||||||
std::string gamepath = fs::RemoveRelativePathComponents(
|
std::string gamepath = fs::RemoveRelativePathComponents(
|
||||||
porting::path_share + DIR_DELIM + "textures");
|
porting::path_user + DIR_DELIM + "textures");
|
||||||
lua_pushstring(L, gamepath.c_str());
|
lua_pushstring(L, gamepath.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -953,11 +953,11 @@ bool ModApiMainMenu::isMinetestPath(std::string path)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* mods */
|
/* mods */
|
||||||
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "files")))
|
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "files")))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* worlds */
|
/* worlds */
|
||||||
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_share + DIR_DELIM + "worlds")))
|
if (fs::PathStartsWith(path,fs::RemoveRelativePathComponents(porting::path_user + DIR_DELIM + "worlds")))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2371,7 +2371,7 @@ void Server::fillMediaCache()
|
||||||
paths.push_back(mod.path + DIR_DELIM + "media");
|
paths.push_back(mod.path + DIR_DELIM + "media");
|
||||||
paths.push_back(mod.path + DIR_DELIM + "models");
|
paths.push_back(mod.path + DIR_DELIM + "models");
|
||||||
}
|
}
|
||||||
paths.push_back(porting::path_share + DIR_DELIM + "textures" + DIR_DELIM + "server");
|
paths.push_back(porting::path_user + DIR_DELIM + "textures" + DIR_DELIM + "server");
|
||||||
|
|
||||||
// Collect media file information from paths into cache
|
// Collect media file information from paths into cache
|
||||||
for(std::vector<std::string>::iterator i = paths.begin();
|
for(std::vector<std::string>::iterator i = paths.begin();
|
||||||
|
|
|
@ -42,9 +42,9 @@ std::string getFilePath()
|
||||||
std::string serverlist_file = g_settings->get("serverlist_file");
|
std::string serverlist_file = g_settings->get("serverlist_file");
|
||||||
|
|
||||||
std::string dir_path = "client" DIR_DELIM "serverlist" DIR_DELIM;
|
std::string dir_path = "client" DIR_DELIM "serverlist" DIR_DELIM;
|
||||||
fs::CreateDir(porting::path_share + DIR_DELIM "client");
|
fs::CreateDir(porting::path_user + DIR_DELIM "client");
|
||||||
fs::CreateDir(porting::path_share + DIR_DELIM + dir_path);
|
fs::CreateDir(porting::path_user + DIR_DELIM + dir_path);
|
||||||
return porting::path_share + DIR_DELIM + dir_path + serverlist_file;
|
return porting::path_user + DIR_DELIM + dir_path + serverlist_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ SubgameSpec findSubgame(const std::string &id)
|
||||||
if(id == "")
|
if(id == "")
|
||||||
return SubgameSpec();
|
return SubgameSpec();
|
||||||
std::string share = porting::path_share;
|
std::string share = porting::path_share;
|
||||||
std::string user = porting::path_share;
|
std::string user = porting::path_user;
|
||||||
std::vector<GameFindPath> find_paths;
|
std::vector<GameFindPath> find_paths;
|
||||||
|
|
||||||
Strfnd search_paths(getSubgamePathEnv());
|
Strfnd search_paths(getSubgamePathEnv());
|
||||||
|
@ -149,7 +149,7 @@ std::set<std::string> getAvailableGameIds()
|
||||||
std::set<std::string> gameids;
|
std::set<std::string> gameids;
|
||||||
std::set<std::string> gamespaths;
|
std::set<std::string> gamespaths;
|
||||||
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
|
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
|
||||||
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
|
gamespaths.insert(porting::path_user + DIR_DELIM + "games");
|
||||||
|
|
||||||
Strfnd search_paths(getSubgamePathEnv());
|
Strfnd search_paths(getSubgamePathEnv());
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ std::vector<WorldSpec> getAvailableWorlds()
|
||||||
while (!search_paths.at_end())
|
while (!search_paths.at_end())
|
||||||
worldspaths.insert(search_paths.next(PATH_DELIM));
|
worldspaths.insert(search_paths.next(PATH_DELIM));
|
||||||
|
|
||||||
worldspaths.insert(porting::path_share + DIR_DELIM + "worlds");
|
worldspaths.insert(porting::path_user + DIR_DELIM + "worlds");
|
||||||
infostream << "Searching worlds..." << std::endl;
|
infostream << "Searching worlds..." << std::endl;
|
||||||
for (std::set<std::string>::const_iterator i = worldspaths.begin();
|
for (std::set<std::string>::const_iterator i = worldspaths.begin();
|
||||||
i != worldspaths.end(); ++i) {
|
i != worldspaths.end(); ++i) {
|
||||||
|
@ -259,7 +259,7 @@ std::vector<WorldSpec> getAvailableWorlds()
|
||||||
}
|
}
|
||||||
// Check old world location
|
// Check old world location
|
||||||
do{
|
do{
|
||||||
std::string fullpath = porting::path_share + DIR_DELIM + "world";
|
std::string fullpath = porting::path_user + DIR_DELIM + "world";
|
||||||
if(!fs::PathExists(fullpath))
|
if(!fs::PathExists(fullpath))
|
||||||
break;
|
break;
|
||||||
std::string name = "Old World";
|
std::string name = "Old World";
|
||||||
|
|
Loading…
Reference in New Issue