Merge with develop

This commit is contained in:
kervala 2016-02-04 14:33:30 +01:00
parent 59dcd867e9
commit cb4c93648e
8 changed files with 86 additions and 39 deletions

View file

@ -230,7 +230,7 @@ public:
/** Get application directory. /** Get application directory.
* \return directory where applications should write files. * \return directory where applications should write files.
*/ */
std::string getApplicationDirectory(const std::string &appName = ""); std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
/** Get a temporary directory. /** Get a temporary directory.
* \return temporary directory where applications should write files. * \return temporary directory where applications should write files.
@ -540,7 +540,7 @@ public:
/** Get application directory. /** Get application directory.
* \return directory where applications should write files. * \return directory where applications should write files.
*/ */
static std::string getApplicationDirectory(const std::string &appName = ""); static std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
/** Get a temporary directory. /** Get a temporary directory.
* \return temporary directory where applications should write files. * \return temporary directory where applications should write files.

View file

@ -715,7 +715,7 @@ SOURCE_GROUP(Stereo FILES
NL_TARGET_LIB(nel3d ${HEADERS} ${SRC}) NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
INCLUDE_DIRECTORIES(BEFORE ${FREETYPE_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIBVR_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${LIBVR_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY}) TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY})

View file

@ -1777,19 +1777,29 @@ std::string CFileContainer::getWindowsDirectory()
#endif #endif
} }
std::string CPath::getApplicationDirectory(const std::string &appName) std::string CPath::getApplicationDirectory(const std::string &appName, bool local)
{ {
return getInstance()->_FileContainer.getApplicationDirectory(appName); return getInstance()->_FileContainer.getApplicationDirectory(appName, local);
} }
std::string CFileContainer::getApplicationDirectory(const std::string &appName) std::string CFileContainer::getApplicationDirectory(const std::string &appName, bool local)
{ {
static std::string appPath; static std::string appPaths[2];
std::string &appPath = appPaths[local ? 1 : 0];
if (appPath.empty()) if (appPath.empty())
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
wchar_t buffer[MAX_PATH]; wchar_t buffer[MAX_PATH];
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE); #ifdef CSIDL_LOCAL_APPDATA
if (local)
{
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_LOCAL_APPDATA, TRUE);
}
else
#endif
{
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
}
appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8()); appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8());
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
appPath = CPath::standardizePath(getenv("HOME")); appPath = CPath::standardizePath(getenv("HOME"));

View file

@ -16,6 +16,7 @@ ADD_EXECUTABLE(ryzom_client_patcher ${SRC})
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${LIBXML2_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}
${CURL_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/ryzom/client/src ${CMAKE_SOURCE_DIR}/ryzom/client/src
) )

View file

@ -34,7 +34,6 @@ uint32 LoginShardId = 0xFFFFFFFF;
CCmdArgs Args; CCmdArgs Args;
bool useUtf8 = false;
bool useEsc = false; bool useEsc = false;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -44,9 +43,6 @@ sint attributes = 0;
std::string convert(const ucstring &str) std::string convert(const ucstring &str)
{ {
if (useUtf8)
return str.toUtf8();
return str.toString(); return str.toString();
} }
@ -97,28 +93,12 @@ void printDownload(const std::string &str)
// temporary modified string // temporary modified string
std::string nstr = str; std::string nstr = str;
uint length = 0; uint length = (uint)nstr.length();
if (useUtf8) if (length > maxLength)
{ {
ucstring ucstr; nstr = std::string("...") + nstr.substr(length - maxLength + 3);
ucstr.fromUtf8(nstr); length = maxLength;
length = (uint)ucstr.length();
if (length > maxLength)
{
ucstr = ucstr.luabind_substr(length - maxLength + 3);
nstr = std::string("...") + ucstr.toUtf8();
length = maxLength;
}
}
else
{
length = (uint)nstr.length();
if (length > maxLength)
{
nstr = std::string("...") + nstr.substr(length - maxLength + 3);
length = maxLength;
}
} }
// add padding with spaces // add padding with spaces
@ -148,6 +128,54 @@ void printDownload(const std::string &str)
fflush(stdout); fflush(stdout);
} }
// hardcoded english translations to not depends on external files
struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy
{
virtual void loadStringFile(const std::string &filename, ucstring &text)
{
text.fromUtf8(
"TheSagaOfRyzom [Ryzom]\n"
"uiErrPatchApply [Error: Patch process ended but the patch has not been successfully applied.]\n"
"uiErrChecking [Error: Patch files failed - checking.]\n"
"uiKb [KiB]\n"
"uiMb [MiB]\n"
"uiLoginGetFile [Getting File:]\n"
"uiDLWithCurl [Downloading File With Curl:]\n"
"uiDecompressing [Decompressing File:]\n"
"uiCheckInt [Checking Integrity:]\n"
"uiNoVersionFound [No Version Found]\n"
"uiVersionFound [Version Found:]\n"
"uiApplyingDelta [Applying Delta:]\n"
"uiClientVersion [Client Version]\n"
"uiServerVersion [Server Version]\n"
"uiCheckingFile [Checking File]\n"
"uiNeededPatches [Required Patches:]\n"
"uiCheckInBNP [Checking inside BNP:]\n"
"uiSHA1Diff [Force BNP Unpacking: checksums do not correspond:]\n"
"uiCheckEndNoErr [Checking file ended with no errors]\n"
"uiCheckEndWithErr [Checking file ended with errors:]\n"
"uiPatchEndNoErr [Patching file ended with no errors]\n"
"uiPatchEndWithErr [Patch failed!]\n"
"uiPatchDiskFull [Disk full!]\n"
"uiPatchWriteError [Disk write error! (disk full?)]\n"
"uiProcessing [Processing file:]\n"
"uiUnpack [BNP Unpacking:]\n"
"uiUnpackErrHead [Cannot read bnp header:]\n"
"uiChangeDate [Changing the mod date:]\n"
"uiChgDateErr [Cannot change file time:]\n"
"uiNowDate [Now the date is:]\n"
"uiSetAttrib [Set file attributes:]\n"
"uiAttribErr [Cannot have read/write access:]\n"
"uiDelFile [Delete file:]\n"
"uiDelErr [Cannot delete file:]\n"
"uiDelNoFile [Delete file (no file)]\n"
"uiRenameFile [Rename File:]\n"
"uiRenameErr [Cannot rename file:]\n"
);
}
};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// init the Nel context // init the Nel context
@ -189,11 +217,6 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
// check if console supports utf-8
std::string lang = toLower(std::string(setlocale(LC_CTYPE, "")));
useUtf8 = (lang.find("utf8") != string::npos || lang.find("utf-8") != string::npos);
lang = lang.substr(0, 2);
// check if console supports colors // check if console supports colors
std::string term = toLower(std::string(getenv("TERM") ? getenv("TERM"):"")); std::string term = toLower(std::string(getenv("TERM") ? getenv("TERM"):""));
useEsc = (term.find("xterm") != string::npos || term.find("linux") != string::npos); useEsc = (term.find("xterm") != string::npos || term.find("linux") != string::npos);
@ -221,8 +244,17 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
// load translation // allocate translations proxy
CI18N::load(lang); CClientPatcherTranslations *trans = new CClientPatcherTranslations();
// use proxy
CI18N::setLoadProxy(trans);
// load english translations
CI18N::load("en");
// now translations are read, we don't need it anymore
delete trans;
printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str()); printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str());

View file

@ -4,6 +4,7 @@ FILE(GLOB SRC *.cpp *.h)
ADD_LIBRARY(georges_dll SHARED ${SRC} georges_edit.rc) ADD_LIBRARY(georges_dll SHARED ${SRC} georges_edit.rc)
INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(georges_dll nelmisc nelgeorges) TARGET_LINK_LIBRARIES(georges_dll nelmisc nelgeorges)
NL_DEFAULT_PROPS(georges_dll "Ryzom, Tools, Georges: Georges Dll") NL_DEFAULT_PROPS(georges_dll "Ryzom, Tools, Georges: Georges Dll")

View file

@ -8,6 +8,8 @@ SET(CMAKE_MFC_FLAG 2)
ADD_EXECUTABLE(world_editor WIN32 ${SRC} world_editor.rc) ADD_EXECUTABLE(world_editor WIN32 ${SRC} world_editor.rc)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SOURCE_GROUP(Resources FILES world_editor.rc) SOURCE_GROUP(Resources FILES world_editor.rc)
TARGET_LINK_LIBRARIES(world_editor TARGET_LINK_LIBRARIES(world_editor

View file

@ -110,6 +110,7 @@
extern bool DontUse3D; extern bool DontUse3D;
#include <libxml/parser.h>
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.