Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-11-07 14:12:11 +01:00
commit 7e2bbe1f37
9 changed files with 244 additions and 226 deletions

View file

@ -144,12 +144,10 @@ public:
* 16 bits encoding can be recognized by the official header :
* 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.
*/
static void readTextFile(const std::string &filename,
ucstring &result, bool forceUtf8 = false,
ucstring &result,
bool fileLookup = true,
bool preprocess = false,
TLineFormat lineFmt = LINE_FMT_NO_CARE,
@ -259,7 +257,7 @@ private:
/// The internal read function, it does the real job of readTextFile
static void _readTextFile(const std::string &filename,
ucstring &result, bool forceUtf8,
ucstring &result,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,

View file

@ -18,7 +18,6 @@
#include "nel/misc/app_context.h"
#include "nel/misc/dynloadlib.h"
#include "nel/misc/command.h"
#include "nel/misc/system_utils.h"
#include <locale.h>

View file

@ -412,7 +412,7 @@ void CConfigFile::reparse (bool lookupPaths)
if (!CPath::lookup(fn, false).empty())
{
ucstring content;
CI18N::readTextFile(fn, content, true, true, true);
CI18N::readTextFile(fn, content, true, true);
string utf8 = content.toUtf8();
CMemStream stream;

View file

@ -117,7 +117,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
*/
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);
// delete [] buffer;
@ -313,7 +313,7 @@ bool readPhraseFile(const std::string &filename, vector<TPhrase> &phrases, bool
{
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);
}
@ -416,9 +416,14 @@ bool readPhraseFileFromString(ucstring const& doc, const std::string &filename,
phrase.Clauses.size()+1);
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);
}
if (first == last)
{
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();
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))
return false;

View file

@ -502,25 +502,39 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
{
// 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++);
// store the final '\n'
if (it != last)
storeComments->push_back(*it++);
storeComments->push_back('\n');
}
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
{
// found a multi line C++ comment. store until we found the closing '*/'
while (it != last && !(*it == '*' && it+1 != last && *(it+1) == '/'))
storeComments->push_back(*it++);
while (it != last && !(*it == '*' && it + 1 != last && *(it + 1) == '/'))
{
// don't put \r
if (*it == '\r')
{
// skip it
++it;
}
else
{
storeComments->push_back(*it++);
}
}
// store the final '*'
if (it != last)
storeComments->push_back(*it++);
// store the final '/'
if (it != last)
storeComments->push_back(*it++);
// and a new line.
storeComments->push_back('\r');
storeComments->push_back('\n');
}
else
@ -656,7 +670,6 @@ bool CI18N::parseMarkedString(ucchar openMark, ucchar closeMark, ucstring::const
void CI18N::readTextFile(const string &filename,
ucstring &result,
bool forceUtf8,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,
@ -666,7 +679,7 @@ void CI18N::readTextFile(const string &filename,
TReadContext readContext;
// 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())
{
@ -709,7 +722,6 @@ void CI18N::skipLine(ucstring::const_iterator &it, ucstring::const_iterator end,
void CI18N::_readTextFile(const string &filename,
ucstring &result,
bool forceUtf8,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,
@ -819,7 +831,7 @@ void CI18N::_readTextFile(const string &filename,
subFilename.c_str());
ucstring inserted;
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
final += inserted;
}
}
@ -873,7 +885,7 @@ void CI18N::_readTextFile(const string &filename,
subFilename.c_str());
ucstring inserted;
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
final += inserted;
}
}

View file

@ -550,7 +550,7 @@ void executeScriptBuf(const string &text)
void executeScriptFile(const string &filename)
{
ucstring temp;
CI18N::readTextFile(filename, temp, false, false, false);
CI18N::readTextFile(filename, temp, false, false);
if (temp.empty())
{

View file

@ -98,6 +98,10 @@ int main(int argc, char *argv[])
QApplication::setApplicationVersion(RYZOM_VERSION);
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();
// load application translations
@ -199,7 +203,7 @@ int main(int argc, char *argv[])
nlinfo("Launching %s", Q2C(tempFile));
// 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));
}
@ -309,7 +313,7 @@ int main(int argc, char *argv[])
QFile::setPermissions(config.getInstallerInstalledFilePath(), QFile::permissions(config.getInstallerInstalledFilePath()) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther);
#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()));
#endif

View file

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
}
ucstring str;
CI18N::readTextFile(inputFile, str, false, false, false);
CI18N::readTextFile(inputFile, str, false, false);
if (outMode == ASCII)
{

File diff suppressed because it is too large Load diff