From 263f4574ac4ba09578762f986f11a5a0a09923d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B5=D1=80=D1=85=D0=B0=D1=80=D0=B4=20PICCORO=20Len?= =?UTF-8?q?z=20McKAY?= Date: Mon, 1 Nov 2021 17:01:52 -0400 Subject: [PATCH] use minetest4 as name per program and files * WIP for https://codeberg.org/minenux/minetest-engine/issues/6 * fix missing include dir for subgame.cpp * some other fixeds --- CMakeLists.txt | 28 +++++++++++----------- src/CMakeLists.txt | 52 ++++++++++++++++++++-------------------- src/cmake_config.h.in | 2 +- src/config.h | 8 +++---- src/debug.cpp | 2 +- src/defaultsettings.cpp | 16 ++++++------- src/game.cpp | 2 +- src/gettext.cpp | 2 +- src/guiKeyChangeMenu.cpp | 2 +- src/main.cpp | 12 +++++----- src/porting.cpp | 24 +++++++++---------- src/porting_android.cpp | 2 +- src/subgame.cpp | 11 +++++---- src/subgame.h | 2 +- 14 files changed, 83 insertions(+), 82 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95f1f28d3..650a7ba44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,14 +7,14 @@ endif() # This can be read from ${PROJECT_NAME} after project() is called project(minetest) -set(PROJECT_NAME_CAPITALIZED "Minetest") +set(PROJECT_NAME_CAPITALIZED "Minetest4") # Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing -set(VERSION_MAJOR 0) -set(VERSION_MINOR 4) +set(VERSION_MAJOR 4) +set(VERSION_MINOR 0) set(VERSION_PATCH 17) -set(VERSION_TWEAK 1) +set(VERSION_TWEAK 3) set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") # Change to false for releases @@ -72,11 +72,11 @@ if(WIN32) set(EXAMPLE_CONF_DIR ".") set(LOCALEDIR "locale") elseif(APPLE) - set(BUNDLE_NAME ${PROJECT_NAME}.app) + set(BUNDLE_NAME ${PROJECT_NAME}${VERSION_MAJOR}.app) set(BUNDLE_PATH "${BUNDLE_NAME}") set(BINDIR ${BUNDLE_NAME}/Contents/MacOS) set(SHAREDIR ${BUNDLE_NAME}/Contents/Resources) - set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}") + set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}${VERSION_MAJOR}") set(EXAMPLE_CONF_DIR ${DOCDIR}) set(LOCALEDIR "${SHAREDIR}/locale") elseif(UNIX) # Linux, BSD etc @@ -91,15 +91,15 @@ elseif(UNIX) # Linux, BSD etc set(ICONDIR "unix/icons") set(LOCALEDIR "locale") else() - set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}") + set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}${VERSION_MAJOR}") set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") - set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") + set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}${VERSION_MAJOR}") set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") set(EXAMPLE_CONF_DIR ${DOCDIR}) set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") - set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale") + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}${VERSION_MAJOR}/locale") endif() endif() @@ -205,7 +205,7 @@ add_subdirectory(src) # CPack -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner game") set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) @@ -214,18 +214,18 @@ set(CPACK_PACKAGE_CONTACT "Perttu Ahola ") if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-win64") else() - set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-win32") endif() set(CPACK_GENERATOR ZIP) elseif(APPLE) set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) - set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-osx") set(CPACK_GENERATOR ZIP) else() - set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux") + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${VERSION_MAJOR}-${VERSION_STRING}-linux") set(CPACK_GENERATOR TGZ) set(CPACK_SOURCE_GENERATOR TGZ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6663b3c4c..e762d9449 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -575,10 +575,10 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin") if(BUILD_CLIENT) - add_executable(${PROJECT_NAME} ${client_SRCS}) - add_dependencies(${PROJECT_NAME} GenerateVersion) + add_executable(${PROJECT_NAME}${VERSION_MAJOR} ${client_SRCS}) + add_dependencies(${PROJECT_NAME}${VERSION_MAJOR} GenerateVersion) set(client_LIBS - ${PROJECT_NAME} + ${PROJECT_NAME}${VERSION_MAJOR} ${ZLIB_LIBRARIES} ${IRRLICHT_LIBRARY} ${OPENGL_LIBRARIES} @@ -608,46 +608,46 @@ if(BUILD_CLIENT) endif() if(USE_CURL) target_link_libraries( - ${PROJECT_NAME} + ${PROJECT_NAME}${VERSION_MAJOR} ${CURL_LIBRARY} ) endif() if(USE_FREETYPE) if(FREETYPE_PKGCONFIG_FOUND) - set_target_properties(${PROJECT_NAME} + set_target_properties(${PROJECT_NAME}${VERSION_MAJOR} PROPERTIES COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}" ) endif() target_link_libraries( - ${PROJECT_NAME} + ${PROJECT_NAME}${VERSION_MAJOR} ${FREETYPE_LIBRARY} ${CGUITTFONT_LIBRARY} ) endif() if (USE_CURSES) - target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${CURSES_LIBRARIES}) endif() if (USE_POSTGRESQL) - target_link_libraries(${PROJECT_NAME} ${POSTGRESQL_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${POSTGRESQL_LIBRARY}) endif() if (USE_LEVELDB) - target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${LEVELDB_LIBRARY}) endif() if (USE_REDIS) - target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${REDIS_LIBRARY}) endif() if (USE_SPATIAL) - target_link_libraries(${PROJECT_NAME} ${SPATIAL_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR} ${SPATIAL_LIBRARY}) endif() endif(BUILD_CLIENT) if(BUILD_SERVER) - add_executable(${PROJECT_NAME}server ${server_SRCS}) - add_dependencies(${PROJECT_NAME}server GenerateVersion) + add_executable(${PROJECT_NAME}${VERSION_MAJOR}server ${server_SRCS}) + add_dependencies(${PROJECT_NAME}${VERSION_MAJOR}server GenerateVersion) target_link_libraries( - ${PROJECT_NAME}server + ${PROJECT_NAME}${VERSION_MAJOR}server ${ZLIB_LIBRARIES} ${SQLITE3_LIBRARY} ${JSON_LIBRARY} @@ -656,26 +656,26 @@ if(BUILD_SERVER) ${GMP_LIBRARY} ${PLATFORM_LIBS} ) - set_target_properties(${PROJECT_NAME}server PROPERTIES + set_target_properties(${PROJECT_NAME}${VERSION_MAJOR}server PROPERTIES COMPILE_DEFINITIONS "SERVER") if (USE_CURSES) - target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${CURSES_LIBRARIES}) endif() if (USE_POSTGRESQL) - target_link_libraries(${PROJECT_NAME}server ${POSTGRESQL_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${POSTGRESQL_LIBRARY}) endif() if (USE_LEVELDB) - target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${LEVELDB_LIBRARY}) endif() if (USE_REDIS) - target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${REDIS_LIBRARY}) endif() if (USE_SPATIAL) - target_link_libraries(${PROJECT_NAME}server ${SPATIAL_LIBRARY}) + target_link_libraries(${PROJECT_NAME}${VERSION_MAJOR}server ${SPATIAL_LIBRARY}) endif() if(USE_CURL) target_link_libraries( - ${PROJECT_NAME}server + ${PROJECT_NAME}${VERSION_MAJOR}server ${CURL_LIBRARY} ) endif() @@ -813,7 +813,7 @@ if(WIN32) endif() if(BUILD_CLIENT) - install(TARGETS ${PROJECT_NAME} + install(TARGETS ${PROJECT_NAME}${VERSION_MAJOR} RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${BINDIR} ARCHIVE DESTINATION ${BINDIR} @@ -831,7 +831,7 @@ if(BUILD_CLIENT) if(USE_GETTEXT) foreach(LOCALE ${GETTEXT_USED_LOCALES}) set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) - set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}${VERSION_MAJOR}.mo") install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH}) endforeach() endif() @@ -852,16 +852,16 @@ if(BUILD_CLIENT) endif(BUILD_CLIENT) if(BUILD_SERVER) - install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR}) + install(TARGETS ${PROJECT_NAME}${VERSION_MAJOR}server DESTINATION ${BINDIR}) endif() if (USE_GETTEXT) set(MO_FILES) - +# the po file is minetest but mo file will be mientest4 foreach(LOCALE ${GETTEXT_USED_LOCALES}) set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME}.po") set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) - set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo") + set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}${VERSION_MAJOR}.mo") add_custom_command(OUTPUT ${MO_BUILD_PATH} COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH} diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index 9a57d3de8..96f30ed34 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -5,7 +5,7 @@ #define PROJECT_NAME "@PROJECT_NAME@" #define PROJECT_NAME_C "@PROJECT_NAME_CAPITALIZED@" -#define VERSION_MAJOR @VERSION_MAJOR@ +#define VERSION_MAJOR @VERSION_MAJOR@ // can be string? #define VERSION_MINOR @VERSION_MINOR@ #define VERSION_PATCH @VERSION_PATCH@ #define VERSION_TWEAK @VERSION_TWEAK@ diff --git a/src/config.h b/src/config.h index 0955ea8f5..bbb23a4d8 100644 --- a/src/config.h +++ b/src/config.h @@ -10,11 +10,10 @@ #define STR(x) STRINGIFY(x) -#if defined USE_CMAKE_CONFIG_H - #include "cmake_config.h" -#elif defined (__ANDROID__) || defined (ANDROID) +#if defined (__ANDROID__) || defined (ANDROID) #define PROJECT_NAME "minetest" - #define PROJECT_NAME_C "Minetest" + #define VERSION_MAJOR "4" + #define PROJECT_NAME_C "Minetest4" #define STATIC_SHAREDIR "" #include "android_version.h" #ifdef NDEBUG @@ -23,6 +22,7 @@ #define BUILD_TYPE "Debug" #endif #else + #include "cmake_config.h" #ifdef NDEBUG #define BUILD_TYPE "Release" #else diff --git a/src/debug.cpp b/src/debug.cpp index 8647160b1..192419c9b 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -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_user + DIR_DELIM PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".dmp"; std::string version_str(PROJECT_NAME " "); version_str += g_version_hash; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 181a12b5e..1081a212d 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., void set_default_settings(Settings *settings) { // Client and server - settings->setDefault("language", ""); + settings->setDefault("language", "en"); settings->setDefault("name", ""); settings->setDefault("bind_address", ""); settings->setDefault("serverlist_url", "servers.minetest.net"); @@ -51,10 +51,10 @@ void set_default_settings(Settings *settings) settings->setDefault("client_mapblock_limit", "5000"); settings->setDefault("enable_build_where_you_stand", "false" ); settings->setDefault("send_pre_v25_init", "false"); - settings->setDefault("curl_timeout", "5000"); + settings->setDefault("curl_timeout", "9000"); settings->setDefault("curl_parallel_limit", "8"); - settings->setDefault("curl_file_download_timeout", "300000"); - settings->setDefault("curl_verify_cert", "true"); + settings->setDefault("curl_file_download_timeout", "400000"); + settings->setDefault("curl_verify_cert", "false"); settings->setDefault("enable_remote_media_server", "true"); settings->setDefault("enable_client_modding", "false"); settings->setDefault("max_out_chat_queue_size", "20"); @@ -267,9 +267,9 @@ void set_default_settings(Settings *settings) settings->setDefault("max_simultaneous_block_sends_server_total", "40"); settings->setDefault("time_send_interval", "5"); - settings->setDefault("default_game", "minetest"); - settings->setDefault("motd", ""); - settings->setDefault("max_users", "15"); + settings->setDefault("default_game", PROJECT_NAME); + settings->setDefault("motd", "minetest 4 server"); + settings->setDefault("max_users", "32"); settings->setDefault("creative_mode", "false"); settings->setDefault("show_statusline_on_connect", "true"); settings->setDefault("enable_damage", "true"); @@ -287,7 +287,7 @@ void set_default_settings(Settings *settings) settings->setDefault("kick_msg_shutdown", "Server shutting down."); settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected."); - settings->setDefault("ask_reconnect_on_crash", "false"); + settings->setDefault("ask_reconnect_on_crash", "true"); settings->setDefault("profiler_print_interval", "0"); settings->setDefault("active_object_send_range_blocks", "3"); diff --git a/src/game.cpp b/src/game.cpp index 5ad93b95a..95ea66fe1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2171,7 +2171,7 @@ bool Game::connectToServer(const std::string &playername, "Most likely the server uses an old protocol version ( Network -> Support older Servers'\n" "entry in the advanced settings menu."; } else { diff --git a/src/gettext.cpp b/src/gettext.cpp index 81d93fef3..b59ce27f5 100644 --- a/src/gettext.cpp +++ b/src/gettext.cpp @@ -217,7 +217,7 @@ void init_gettext(const char *path, const std::string &configured_language, #endif #endif - static std::string name = lowercase(PROJECT_NAME); + static std::string name = lowercase(PROJECT_NAME)+std::to_string(VERSION_MAJOR); bindtextdomain(name.c_str(), path); textdomain(name.c_str()); diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index ae53c56f9..f30b4cac5 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -129,7 +129,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) core::rect < s32 > rect(0, 0, 600, 40); rect += topleft + v2s32(25, 3); //gui::IGUIStaticText *t = - const wchar_t *text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)"); + const wchar_t *text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest4.conf)"); Environment->addStaticText(text, rect, false, true, this, -1); delete[] text; diff --git a/src/main.cpp b/src/main.cpp index 6a2e89f7a..88c462653 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -456,7 +456,7 @@ static bool init_common(const Settings &cmd_args, int argc, char *argv[]) static void startup_message() { - infostream << PROJECT_NAME << " " << _("with") + infostream << PROJECT_NAME << std::to_string(VERSION_MAJOR) << " " << _("with") << " SER_FMT_VER_HIGHEST_READ=" << (int)SER_FMT_VER_HIGHEST_READ << ", " << g_build_info << std::endl; @@ -477,16 +477,16 @@ static bool read_config_file(const Settings &cmd_args) g_settings_path = cmd_args.get("config"); } else { std::vector filenames; - filenames.push_back(porting::path_user + DIR_DELIM + "minetest.conf"); + filenames.push_back(porting::path_user + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".conf"); // Legacy configuration file location filenames.push_back(porting::path_user + - DIR_DELIM + ".." + DIR_DELIM + "minetest.conf"); + DIR_DELIM + ".." + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".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 + - DIR_DELIM + ".." + DIR_DELIM + ".." + DIR_DELIM + "minetest.conf"); + DIR_DELIM + ".." + DIR_DELIM + ".." + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".conf"); #endif for (size_t i = 0; i < filenames.size(); i++) { @@ -739,7 +739,7 @@ static bool determine_subgame(GameParams *game_params) if (game_params->game_spec.isValid()) { gamespec = game_params->game_spec; infostream << "Using commanded gameid [" << gamespec.id << "]" << std::endl; - } else { // Otherwise we will be using "minetest" + } else { // Otherwise we will be using default_game from config gamespec = findSubgame(g_settings->get("default_game")); infostream << "Using default gameid [" << gamespec.id << "]" << std::endl; if (!gamespec.isValid()) { @@ -828,7 +828,7 @@ static bool run_dedicated_server(const GameParams &game_params, const Settings & if (!name_ok) { if (admin_nick.empty()) { errorstream << "No name given for admin. " - << "Please check your minetest.conf that it " + << "Please check your minetest.conf or config file that it " << "contains a 'name = ' to your main admin account." << std::endl; } else { diff --git a/src/porting.cpp b/src/porting.cpp index 0a9de2a59..e2c7e0733 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -378,7 +378,7 @@ 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; + path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR); return true; } @@ -410,7 +410,7 @@ bool setSystemPaths() trylist.push_back(static_sharedir); trylist.push_back(bindir + DIR_DELIM ".." DIR_DELIM "share" - DIR_DELIM + PROJECT_NAME); + DIR_DELIM + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR)); trylist.push_back(bindir + DIR_DELIM ".."); #ifdef __ANDROID__ @@ -439,7 +439,7 @@ bool setSystemPaths() #ifndef __ANDROID__ path_user = std::string(getenv("HOME")) + DIR_DELIM "." - + PROJECT_NAME; + + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR); #endif return true; @@ -464,7 +464,7 @@ bool setSystemPaths() path_user = std::string(getenv("HOME")) + "/Library/Application Support/" - + PROJECT_NAME; + + PROJECT_NAME + std::to_string(VERSION_MAJOR); return true; } @@ -475,7 +475,7 @@ bool setSystemPaths() { path_share = STATIC_SHAREDIR; path_user = std::string(getenv("HOME")) + DIR_DELIM "." - + lowercase(PROJECT_NAME); + + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR); return true; } @@ -553,15 +553,15 @@ void initializePaths() errorstream << "Failed to get one or more system-wide path" << std::endl; // Initialize path_cache - // First try $XDG_CACHE_HOME/PROJECT_NAME + // First try $XDG_CACHE_HOME/PROJECT_NAME + std::to_string(VERSION_MAJOR) const char *cache_dir = getenv("XDG_CACHE_HOME"); const char *home_dir = getenv("HOME"); if (cache_dir) { - path_cache = std::string(cache_dir) + DIR_DELIM + PROJECT_NAME; + path_cache = std::string(cache_dir) + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR); } else if (home_dir) { - // Then try $HOME/.cache/PROJECT_NAME + // Then try $HOME/.cache/PROJECT_NAME + std::to_string(VERSION_MAJOR) path_cache = std::string(home_dir) + DIR_DELIM + ".cache" - + DIR_DELIM + PROJECT_NAME; + + DIR_DELIM + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR); } else { // If neither works, use $PATH_USER/cache path_cache = path_user + DIR_DELIM + "cache"; @@ -626,16 +626,16 @@ bool setWindowIcon(IrrlichtDevice *device) #if defined(XORG_USED) # if RUN_IN_PLACE return setXorgWindowIconFromPath(device, - path_share + "/misc/" PROJECT_NAME "-xorg-icon-128.png"); + path_share + "/misc/" + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR) + "-xorg-icon-128.png"); # else // We have semi-support for reading in-place data if we are // compiled with RUN_IN_PLACE. Don't break with this and // also try the path_share location. return setXorgWindowIconFromPath(device, - ICON_DIR "/hicolor/128x128/apps/" PROJECT_NAME ".png") || + ICON_DIR "/hicolor/128x128/apps/" + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR) + ".png") || setXorgWindowIconFromPath(device, - path_share + "/misc/" PROJECT_NAME "-xorg-icon-128.png"); + path_share + "/misc/" + lowercase(PROJECT_NAME) + std::to_string(VERSION_MAJOR) + "-xorg-icon-128.png"); # endif #elif defined(_WIN32) const video::SExposedVideoData exposedData = device->getVideoDriver()->getExposedVideoData(); diff --git a/src/porting_android.cpp b/src/porting_android.cpp index 72b625d73..c3bcf3ae2 100644 --- a/src/porting_android.cpp +++ b/src/porting_android.cpp @@ -48,7 +48,7 @@ void android_main(android_app *app) try { app_dummy(); - char *argv[] = {strdup(PROJECT_NAME), NULL}; + char *argv[] = {strdup(PROJECT_NAME), NULL}; // TODO std::to_string(VERSION_MAJOR) added main(ARRLEN(argv) - 1, argv); free(argv[0]); } catch (std::exception &e) { diff --git a/src/subgame.cpp b/src/subgame.cpp index 55bbd3954..56a40e141 100644 --- a/src/subgame.cpp +++ b/src/subgame.cpp @@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include "subgame.h" #include "porting.h" #include "filesys.h" @@ -33,13 +34,13 @@ with this program; if not, write to the Free Software Foundation, Inc., bool getGameMinetestConfig(const std::string &game_path, Settings &conf) { - std::string conf_path = game_path + DIR_DELIM + "minetest.conf"; + std::string conf_path = game_path + DIR_DELIM + PROJECT_NAME + std::to_string(VERSION_MAJOR) + ".conf"; // inside game dir return conf.readConfigFile(conf_path.c_str()); } bool getGameConfig(const std::string &game_path, Settings &conf) { - std::string conf_path = game_path + DIR_DELIM + "game.conf"; + std::string conf_path = game_path + DIR_DELIM + "game.conf"; // this a file inside game dir return conf.readConfigFile(conf_path.c_str()); } @@ -188,7 +189,7 @@ std::vector getAvailableGames() return specs; } -#define LEGACY_GAMEID "minetest" +#define LEGACY_GAMEID "minetest" // must read minetest cos is legacy older releases inclusivelly from minetest 0.4 bool getWorldExists(const std::string &world_path) { @@ -200,7 +201,7 @@ std::string getWorldGameId(const std::string &world_path, bool can_be_legacy) { std::string conf_path = world_path + DIR_DELIM + "world.mt"; Settings conf; - bool succeeded = conf.readConfigFile(conf_path.c_str()); + bool succeeded = conf.readConfigFile(conf_path.c_str()); // TODO check if(!succeeded){ if(can_be_legacy){ // If map_meta.txt exists, it is probably an old minetest world @@ -213,7 +214,7 @@ std::string getWorldGameId(const std::string &world_path, bool can_be_legacy) return ""; // The "mesetint" gameid has been discarded if(conf.get("gameid") == "mesetint") - return "minetest"; + return LEGACY_GAMEID; return conf.get("gameid"); } diff --git a/src/subgame.h b/src/subgame.h index f3633ce2f..e5aa5c2f8 100644 --- a/src/subgame.h +++ b/src/subgame.h @@ -57,7 +57,7 @@ struct SubgameSpec } }; -// minetest.conf +// minetest4.conf bool getGameMinetestConfig(const std::string &game_path, Settings &conf); // game.conf bool getGameConfig(const std::string &game_path, Settings &conf);