Only lowercase project name at compile time
authorShadowNinja <shadowninja@minetest.net>
Tue, 21 Apr 2015 15:09:44 +0000 (11:09 -0400)
committerShadowNinja <shadowninja@minetest.net>
Wed, 22 Apr 2015 00:51:16 +0000 (20:51 -0400)
src/cmake_config.h.in
src/config.h
src/gettext.cpp
src/porting.cpp

index 7d446d17872cb4928f6146f81e64114327b666d4..c37858509853fcccf95c233c5a34dbb7f6a915a7 100644 (file)
@@ -4,6 +4,7 @@
 #define CMAKE_CONFIG_H
 
 #define PROJECT_NAME "@PROJECT_NAME@"
+#define PROJECT_NAME_LOWER "@PROJECT_NAME_LOWER@"
 #define VERSION_MAJOR @VERSION_MAJOR@
 #define VERSION_MINOR @VERSION_MINOR@
 #define VERSION_PATCH @VERSION_PATCH@
index df7429be0cb83c242a41efd6472096ad3f610ab7..8f475fce4a671a6d742d6f48dae470773d4c6401 100644 (file)
@@ -14,6 +14,7 @@
        #include "cmake_config.h"
 #elif defined (__ANDROID__) || defined (ANDROID)
        #define PROJECT_NAME "Minetest"
+       #define PROJECT_NAME_LOWER "minetest"
        #define STATIC_SHAREDIR ""
        #include "android_version.h"
        #ifdef NDEBUG
index 509d506d42239230da033fda148931a08e67a786..85455ad3cb019785697b6b3284190b54e54ba581 100644 (file)
@@ -236,9 +236,8 @@ void init_gettext(const char *path, const std::string &configured_language) {
 #endif
 #endif
 
-       static std::string name = lowercase(PROJECT_NAME);
-       bindtextdomain(name.c_str(), path);
-       textdomain(name.c_str());
+       bindtextdomain(PROJECT_NAME_LOWER, path);
+       textdomain(PROJECT_NAME_LOWER);
 
 #if defined(_WIN32)
        // Set character encoding for Win32
index eb7fea94c24678f32acbbfc6deb346f2e11ba6ab..8ea61f7ccf030a46dc0a3fd39aa665acbee2037f 100644 (file)
@@ -478,11 +478,11 @@ bool setSystemPaths()
        // Use ".\bin\.."
        path_share = std::string(buf) + "\\..";
 
-       // Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
+       // Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME_LOWER>"
        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 + lowercase(PROJECT_NAME);
+       path_user = std::string(buf) + DIR_DELIM PROJECT_NAME_LOWER;
        return true;
 }
 
@@ -514,7 +514,7 @@ bool setSystemPaths()
                trylist.push_back(static_sharedir);
 
        trylist.push_back(bindir + DIR_DELIM ".." DIR_DELIM "share"
-               DIR_DELIM + lowercase(PROJECT_NAME));
+               DIR_DELIM PROJECT_NAME_LOWER);
        trylist.push_back(bindir + DIR_DELIM "..");
 
 #ifdef __ANDROID__
@@ -543,7 +543,7 @@ bool setSystemPaths()
 
 #ifndef __ANDROID__
        path_user = std::string(getenv("HOME")) + DIR_DELIM "."
-               + lowercase(PROJECT_NAME);
+               PROJECT_NAME_LOWER;
 #endif
 
        return true;
@@ -566,9 +566,8 @@ bool setSystemPaths()
        }
        CFRelease(resources_url);
 
-       path_user = std::string(getenv("HOME"))
-               + "/Library/Application Support/"
-               + lowercase(PROJECT_NAME);
+       path_user = std::string(getenv("HOME")) +
+               "/Library/Application Support/" PROJECT_NAME_LOWER;
        return true;
 }
 
@@ -579,7 +578,7 @@ bool setSystemPaths()
 {
        path_share = STATIC_SHAREDIR;
        path_user  = std::string(getenv("HOME")) + DIR_DELIM "."
-               + lowercase(PROJECT_NAME);
+               PROJECT_NAME_LOWER;
        return true;
 }