Merge with develop
This commit is contained in:
parent
e157a7453e
commit
4438ab108c
9 changed files with 244 additions and 226 deletions
|
@ -144,12 +144,10 @@ public:
|
||||||
* 16 bits encoding can be recognized by the official header :
|
* 16 bits encoding can be recognized by the official header :
|
||||||
* FF, FE, witch can be reversed if the data are MSB first.
|
* FF, FE, witch can be reversed if the data are MSB first.
|
||||||
*
|
*
|
||||||
* Optionally, you can force the reader to consider the file as
|
|
||||||
* UTF-8 encoded.
|
|
||||||
* Optionally, you can ask the reader to interpret #include commands.
|
* Optionally, you can ask the reader to interpret #include commands.
|
||||||
*/
|
*/
|
||||||
static void readTextFile(const std::string &filename,
|
static void readTextFile(const std::string &filename,
|
||||||
ucstring &result, bool forceUtf8 = false,
|
ucstring &result,
|
||||||
bool fileLookup = true,
|
bool fileLookup = true,
|
||||||
bool preprocess = false,
|
bool preprocess = false,
|
||||||
TLineFormat lineFmt = LINE_FMT_NO_CARE,
|
TLineFormat lineFmt = LINE_FMT_NO_CARE,
|
||||||
|
@ -259,7 +257,7 @@ private:
|
||||||
|
|
||||||
/// The internal read function, it does the real job of readTextFile
|
/// The internal read function, it does the real job of readTextFile
|
||||||
static void _readTextFile(const std::string &filename,
|
static void _readTextFile(const std::string &filename,
|
||||||
ucstring &result, bool forceUtf8,
|
ucstring &result,
|
||||||
bool fileLookup,
|
bool fileLookup,
|
||||||
bool preprocess,
|
bool preprocess,
|
||||||
TLineFormat lineFmt,
|
TLineFormat lineFmt,
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "nel/misc/app_context.h"
|
#include "nel/misc/app_context.h"
|
||||||
#include "nel/misc/dynloadlib.h"
|
#include "nel/misc/dynloadlib.h"
|
||||||
#include "nel/misc/command.h"
|
#include "nel/misc/command.h"
|
||||||
#include "nel/misc/system_utils.h"
|
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ void CConfigFile::reparse (bool lookupPaths)
|
||||||
if (!CPath::lookup(fn, false).empty())
|
if (!CPath::lookup(fn, false).empty())
|
||||||
{
|
{
|
||||||
ucstring content;
|
ucstring content;
|
||||||
CI18N::readTextFile(fn, content, true, true, true);
|
CI18N::readTextFile(fn, content, true, true);
|
||||||
string utf8 = content.toUtf8();
|
string utf8 = content.toUtf8();
|
||||||
|
|
||||||
CMemStream stream;
|
CMemStream stream;
|
||||||
|
|
|
@ -117,7 +117,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
|
||||||
*/
|
*/
|
||||||
ucstring text;
|
ucstring text;
|
||||||
|
|
||||||
CI18N::readTextFile(filename, text, false, false, true, CI18N::LINE_FMT_LF);
|
CI18N::readTextFile(filename, text, false, true, CI18N::LINE_FMT_LF);
|
||||||
// CI18N::readTextBuffer(buffer, size, text);
|
// CI18N::readTextBuffer(buffer, size, text);
|
||||||
// delete [] buffer;
|
// delete [] buffer;
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ bool readPhraseFile(const std::string &filename, vector<TPhrase> &phrases, bool
|
||||||
{
|
{
|
||||||
ucstring doc;
|
ucstring doc;
|
||||||
|
|
||||||
CI18N::readTextFile(filename, doc, false, false, true, CI18N::LINE_FMT_LF);
|
CI18N::readTextFile(filename, doc, false, true, CI18N::LINE_FMT_LF);
|
||||||
|
|
||||||
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
|
||||||
}
|
}
|
||||||
|
@ -416,9 +416,14 @@ bool readPhraseFileFromString(ucstring const& doc, const std::string &filename,
|
||||||
phrase.Clauses.size()+1);
|
phrase.Clauses.size()+1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
clause.Conditions += "(" + cond + ") ";
|
|
||||||
|
// only prepend a space if required
|
||||||
|
if (!clause.Conditions.empty()) clause.Conditions += " ";
|
||||||
|
|
||||||
|
clause.Conditions += "(" + cond + ")";
|
||||||
CI18N::skipWhiteSpace(first, last, &clause.Comments);
|
CI18N::skipWhiteSpace(first, last, &clause.Comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first == last)
|
if (first == last)
|
||||||
{
|
{
|
||||||
nlwarning("DT: in '%s': Found end of file in non closed block for phrase %s\n",
|
nlwarning("DT: in '%s': Found end of file in non closed block for phrase %s\n",
|
||||||
|
@ -626,7 +631,7 @@ bool loadExcelSheet(const string filename, TWorksheet &worksheet, bool checkUniq
|
||||||
fp.close();
|
fp.close();
|
||||||
|
|
||||||
ucstring str;
|
ucstring str;
|
||||||
CI18N::readTextFile(filename, str, false, false, false, CI18N::LINE_FMT_LF);
|
CI18N::readTextFile(filename, str, false, false, CI18N::LINE_FMT_LF);
|
||||||
|
|
||||||
if (!readExcelSheet(str, worksheet, checkUnique))
|
if (!readExcelSheet(str, worksheet, checkUnique))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -502,25 +502,39 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
|
||||||
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
|
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
|
||||||
{
|
{
|
||||||
// found a one line C comment. Store it until end of line.
|
// found a one line C comment. Store it until end of line.
|
||||||
while (it != last && *it != '\n')
|
while (it != last && (*it != '\n' && *it != '\r'))
|
||||||
storeComments->push_back(*it++);
|
storeComments->push_back(*it++);
|
||||||
|
|
||||||
// store the final '\n'
|
// store the final '\n'
|
||||||
if (it != last)
|
if (it != last)
|
||||||
storeComments->push_back(*it++);
|
storeComments->push_back('\n');
|
||||||
}
|
}
|
||||||
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
|
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
|
||||||
{
|
{
|
||||||
// found a multi line C++ comment. store until we found the closing '*/'
|
// found a multi line C++ comment. store until we found the closing '*/'
|
||||||
while (it != last && !(*it == '*' && it+1 != last && *(it+1) == '/'))
|
while (it != last && !(*it == '*' && it + 1 != last && *(it + 1) == '/'))
|
||||||
storeComments->push_back(*it++);
|
{
|
||||||
|
// don't put \r
|
||||||
|
if (*it == '\r')
|
||||||
|
{
|
||||||
|
// skip it
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
storeComments->push_back(*it++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// store the final '*'
|
// store the final '*'
|
||||||
if (it != last)
|
if (it != last)
|
||||||
storeComments->push_back(*it++);
|
storeComments->push_back(*it++);
|
||||||
|
|
||||||
// store the final '/'
|
// store the final '/'
|
||||||
if (it != last)
|
if (it != last)
|
||||||
storeComments->push_back(*it++);
|
storeComments->push_back(*it++);
|
||||||
|
|
||||||
// and a new line.
|
// and a new line.
|
||||||
storeComments->push_back('\r');
|
|
||||||
storeComments->push_back('\n');
|
storeComments->push_back('\n');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -656,7 +670,6 @@ bool CI18N::parseMarkedString(ucchar openMark, ucchar closeMark, ucstring::const
|
||||||
|
|
||||||
void CI18N::readTextFile(const string &filename,
|
void CI18N::readTextFile(const string &filename,
|
||||||
ucstring &result,
|
ucstring &result,
|
||||||
bool forceUtf8,
|
|
||||||
bool fileLookup,
|
bool fileLookup,
|
||||||
bool preprocess,
|
bool preprocess,
|
||||||
TLineFormat lineFmt,
|
TLineFormat lineFmt,
|
||||||
|
@ -666,7 +679,7 @@ void CI18N::readTextFile(const string &filename,
|
||||||
TReadContext readContext;
|
TReadContext readContext;
|
||||||
|
|
||||||
// call the inner function
|
// call the inner function
|
||||||
_readTextFile(filename, result, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
_readTextFile(filename, result, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||||
|
|
||||||
if (!readContext.IfStack.empty())
|
if (!readContext.IfStack.empty())
|
||||||
{
|
{
|
||||||
|
@ -709,7 +722,6 @@ void CI18N::skipLine(ucstring::const_iterator &it, ucstring::const_iterator end,
|
||||||
|
|
||||||
void CI18N::_readTextFile(const string &filename,
|
void CI18N::_readTextFile(const string &filename,
|
||||||
ucstring &result,
|
ucstring &result,
|
||||||
bool forceUtf8,
|
|
||||||
bool fileLookup,
|
bool fileLookup,
|
||||||
bool preprocess,
|
bool preprocess,
|
||||||
TLineFormat lineFmt,
|
TLineFormat lineFmt,
|
||||||
|
@ -819,7 +831,7 @@ void CI18N::_readTextFile(const string &filename,
|
||||||
subFilename.c_str());
|
subFilename.c_str());
|
||||||
|
|
||||||
ucstring inserted;
|
ucstring inserted;
|
||||||
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||||
final += inserted;
|
final += inserted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -873,7 +885,7 @@ void CI18N::_readTextFile(const string &filename,
|
||||||
subFilename.c_str());
|
subFilename.c_str());
|
||||||
|
|
||||||
ucstring inserted;
|
ucstring inserted;
|
||||||
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
|
||||||
final += inserted;
|
final += inserted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,7 +550,7 @@ void executeScriptBuf(const string &text)
|
||||||
void executeScriptFile(const string &filename)
|
void executeScriptFile(const string &filename)
|
||||||
{
|
{
|
||||||
ucstring temp;
|
ucstring temp;
|
||||||
CI18N::readTextFile(filename, temp, false, false, false);
|
CI18N::readTextFile(filename, temp, false, false);
|
||||||
|
|
||||||
if (temp.empty())
|
if (temp.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,6 +98,10 @@ int main(int argc, char *argv[])
|
||||||
QApplication::setApplicationVersion(RYZOM_VERSION);
|
QApplication::setApplicationVersion(RYZOM_VERSION);
|
||||||
QApplication::setWindowIcon(QIcon(":/icons/ryzom.ico"));
|
QApplication::setWindowIcon(QIcon(":/icons/ryzom.ico"));
|
||||||
|
|
||||||
|
// remove first argument because it's not really an argument
|
||||||
|
QStringList args = QApplication::arguments();
|
||||||
|
args.removeFirst();
|
||||||
|
|
||||||
QLocale locale = QLocale::system();
|
QLocale locale = QLocale::system();
|
||||||
|
|
||||||
// load application translations
|
// load application translations
|
||||||
|
@ -199,7 +203,7 @@ int main(int argc, char *argv[])
|
||||||
nlinfo("Launching %s", Q2C(tempFile));
|
nlinfo("Launching %s", Q2C(tempFile));
|
||||||
|
|
||||||
// launch copy in TEMP directory with same arguments
|
// launch copy in TEMP directory with same arguments
|
||||||
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
|
if (QProcess::startDetached(tempFile, args, tempPath)) return 0;
|
||||||
|
|
||||||
nlwarning("Unable to launch %s", Q2C(tempFile));
|
nlwarning("Unable to launch %s", Q2C(tempFile));
|
||||||
}
|
}
|
||||||
|
@ -309,7 +313,7 @@ int main(int argc, char *argv[])
|
||||||
QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);
|
QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
if (QProcess::startDetached(config.getInstallerInstalledFilePath(), args, config.getInstallationDirectory())) return 0;
|
||||||
|
|
||||||
nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
|
nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
ucstring str;
|
ucstring str;
|
||||||
CI18N::readTextFile(inputFile, str, false, false, false);
|
CI18N::readTextFile(inputFile, str, false, false);
|
||||||
|
|
||||||
if (outMode == ASCII)
|
if (outMode == ASCII)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue