diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index dceb0aa36..24c74ebe0 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -33,6 +33,7 @@ #include "view.h" // For the cameraDistance funtion #include "user_entity.h" #include "misc.h" +#include "user_agent.h" // 3D Interface. #include "nel/3d/u_driver.h" @@ -40,10 +41,6 @@ // Game Share. #include "game_share/time_weather_season/time_and_season.h" -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif // HAVE_CONFIG_H - #ifdef NL_OS_MAC #include "app_bundle_utils.h" #endif // NL_OS_MAC @@ -1994,10 +1991,10 @@ void CClientConfig::init(const string &configFileName) if (varPtr) { string str = varPtr->asString (); - if (str != RYZOM_VERSION && ClientCfg.SaveConfig) + if (str != getVersion() && ClientCfg.SaveConfig) { - nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str.c_str(), RYZOM_VERSION); - varPtr->setAsString (RYZOM_VERSION); + nlinfo ("Update and save the ClientVersion variable in config file %s -> %s", str.c_str(), getVersion().c_str()); + varPtr->setAsString (getVersion()); ClientCfg.ConfigFile.save (); } } @@ -2211,12 +2208,12 @@ bool CClientConfig::getDefaultConfigLocation(std::string& p_name) const #ifdef NL_OS_MAC // on mac, client_default.cfg should be searched in .app/Contents/Resources/ defaultConfigPath = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources/"); -#elif defined(RYZOM_ETC_PREFIX) +#elif defined(NL_OS_UNIX) // if RYZOM_ETC_PREFIX is defined, client_default.cfg might be over there - defaultConfigPath = CPath::standardizePath(RYZOM_ETC_PREFIX); + if (!getRyzomEtcPrefix().empty()) defaultConfigPath = CPath::standardizePath(getRyzomEtcPrefix()); #else // some other prefix here :) -#endif // RYZOM_ETC_PREFIX +#endif // NL_OS_UNIX // look in the current working directory first if (CFile::isExists(defaultConfigFileName)) diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index c80d0701d..754dec7d7 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -99,10 +99,7 @@ #include "far_tp.h" #include "zone_util.h" #include "nel/gui/lua_manager.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "user_agent.h" // @@ -690,10 +687,10 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", " sys += "AttachedFile "+filename+" "; } - sys += "ClientVersion "RYZOM_VERSION" "; + sys += NLMISC::toString("ClientVersion %s ", getVersion().c_str()); // for now, set the same version than client one - sys += "ShardVersion "RYZOM_VERSION" "; + sys += NLMISC::toString("ShardVersion %s ", getVersion().c_str()); if (ClientCfg.Local) sys += "ShardName OFFLINE "; diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 6b75933e8..6739136fb 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -95,14 +95,6 @@ #include "browse_faq.h" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef RYZOM_CLIENT_ICON -#define RYZOM_CLIENT_ICON "ryzom_client" -#endif - // XMLLib #include @@ -682,8 +674,8 @@ void addSearchPaths(IProgressCallback &progress) #ifdef NL_OS_MAC defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources"); -#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX) - defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX)); +#elif defined(NL_OS_UNIX) + if (!getRyzomSharePrefix().empty()) defaultDirectory = CPath::standardizePath(getRyzomSharePrefix()); #endif // add in last position, a specific possibly read only directory @@ -727,8 +719,9 @@ void addPreDataPaths(NLMISC::IProgressCallback &progress) #ifdef NL_OS_MAC defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources"); -#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX) +#elif defined(NL_OS_UNIX) defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX)); + if (!getRyzomSharePrefix().empty()) defaultDirectory = CPath::standardizePath(getRyzomSharePrefix()); #endif // add in last position, a specific possibly read only directory @@ -767,7 +760,7 @@ static bool addRyzomIconBitmap(const std::string &directory, vector &bi if (CFile::isDirectory(directory)) { // build filename from directory and default ryzom client icon name - std::string filename = NLMISC::toString("%s/%s.png", directory.c_str(), RYZOM_CLIENT_ICON); + std::string filename = NLMISC::toString("%s/%s.png", directory.c_str(), getRyzomClientIcon().c_str()); if (CFile::fileExists(filename)) { diff --git a/code/ryzom/client/src/user_agent.cpp b/code/ryzom/client/src/user_agent.cpp index 424272c6d..7ba2b4e38 100644 --- a/code/ryzom/client/src/user_agent.cpp +++ b/code/ryzom/client/src/user_agent.cpp @@ -43,6 +43,10 @@ #define RYZOM_SYSTEM "unknown" #endif +#ifndef RYZOM_CLIENT_ICON +#define RYZOM_CLIENT_ICON "ryzom_client" +#endif + std::string getUserAgent() { return getUserAgentName() + "/" + getUserAgentVersion(); @@ -114,3 +118,18 @@ bool isStereoAvailable() return false; #endif } + +std::string getRyzomClientIcon() +{ + return RYZOM_CLIENT_ICON; +} + +std::string getRyzomEtcPrefix() +{ + return RYZOM_ETC_PREFIX; +} + +std::string getRyzomSharePrefix() +{ + return RYZOM_SHARE_PREFIX; +} diff --git a/code/ryzom/client/src/user_agent.h b/code/ryzom/client/src/user_agent.h index 1f2c639c9..52f1fc69a 100644 --- a/code/ryzom/client/src/user_agent.h +++ b/code/ryzom/client/src/user_agent.h @@ -27,6 +27,10 @@ std::string getDebugVersion(); bool isStereoAvailable(); +std::string getRyzomClientIcon(); +std::string getRyzomEtcPrefix(); +std::string getRyzomSharePrefix(); + #endif // CL_USER_AGENT_H /* End of user_agent.h */