diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index 1558b0fcfab63c894ca61546b51188172a46f201..e69d6c4c0dab408b1904de69bf1029357f207441 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -20,8 +20,8 @@ endif() if(NOT JSONCPP_FOUND) message(STATUS "Using bundled JSONCPP library.") - set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json) + set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jsoncpp) set(JSON_LIBRARY jsoncpp) - add_subdirectory(json) + add_subdirectory(jsoncpp/json) endif() diff --git a/src/convert_json.h b/src/convert_json.h index 6732fcfa3148b52a078f5e4f2e95da9b9f9b9d2b..55321af5fe3f51122fe6c16651de344b1ffaf6aa 100644 --- a/src/convert_json.h +++ b/src/convert_json.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef __CONVERT_JSON_H__ #define __CONVERT_JSON_H__ -#include "json/json.h" +#include <json/json.h> struct ModStoreMod; struct ModStoreModDetails; diff --git a/src/json/CMakeLists.txt b/src/jsoncpp/json/CMakeLists.txt similarity index 100% rename from src/json/CMakeLists.txt rename to src/jsoncpp/json/CMakeLists.txt diff --git a/src/json/UPDATING b/src/jsoncpp/json/UPDATING similarity index 100% rename from src/json/UPDATING rename to src/jsoncpp/json/UPDATING diff --git a/src/json/json.h b/src/jsoncpp/json/json.h similarity index 100% rename from src/json/json.h rename to src/jsoncpp/json/json.h diff --git a/src/json/jsoncpp.cpp b/src/jsoncpp/json/jsoncpp.cpp similarity index 100% rename from src/json/jsoncpp.cpp rename to src/jsoncpp/json/jsoncpp.cpp diff --git a/src/mods.h b/src/mods.h index 12576516dc0edc5a6ea8171e02e663d788dccc7e..af7777d18444eb5a6130288f5ba8f6671404ef15 100644 --- a/src/mods.h +++ b/src/mods.h @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <vector> #include <string> #include <map> -#include "json/json.h" +#include <json/json.h> #include "config.h" #define MODNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_" diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 06e20c2a0bd42c1c5922c71bb2b4260a0a940d27..c664101eaba6825acd21251a1cdb55fe9b91f6af 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include "mg_schematic.h" #include "noise.h" -#include "json/json.h" +#include <json/json.h> struct EnumString es_TileAnimationType[] = { @@ -1250,8 +1250,13 @@ static bool push_json_value_helper(lua_State *L, const Json::Value &value, lua_newtable(L); for (Json::Value::const_iterator it = value.begin(); it != value.end(); ++it) { +#ifndef JSONCPP_STRING const char *str = it.memberName(); lua_pushstring(L, str ? str : ""); +#else + std::string str = it.name(); + lua_pushstring(L, str.c_str()); +#endif push_json_value_helper(L, *it, nullindex); lua_rawset(L, -3); } diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 95a5fc4d10fb59412cc0850890b67f8d886846de..13c0d702f1a5e64ed8401d0c314039c7b210c97e 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_content.h" #include "cpp_api/s_async.h" #include "serialization.h" -#include "json/json.h" +#include <json/json.h> #include "cpp_api/s_security.h" #include "porting.h" #include "debug.h" diff --git a/src/serverlist.cpp b/src/serverlist.cpp index de7962a6890af8ed8fd84f7ed4b9065b7cb7b31d..87ca5dc04487c1ba5b74af2dd85b6449d744c66d 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #include "log.h" #include "network/networkprotocol.h" -#include "json/json.h" +#include <json/json.h> #include "convert_json.h" #include "httpfetch.h" #include "util/string.h" diff --git a/src/serverlist.h b/src/serverlist.h index 8ffea44cc70e579f69f678fc6e0742aa2fd8b4c1..0747c39202fd0dc1d3714e2c196e61028a3991da 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <iostream> #include "config.h" #include "mods.h" -#include "json/json.h" +#include <json/json.h> #ifndef SERVERLIST_HEADER #define SERVERLIST_HEADER