Fix luaenginec legacy build

This commit is contained in:
Syping 2021-05-01 15:32:32 +02:00
parent 51b3694661
commit 7603ed4160

View file

@ -24,6 +24,12 @@
#include <QFile>
#include <QDir>
#if QT_VERSION >= 0x050F00
#define le_endl Qt::endl
#else
#define le_endl endl
#endif
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@ -47,7 +53,7 @@ int main(int argc, char *argv[])
QString outputFile;
const QStringList args = parser.positionalArguments();
if (args.length() < 1) {
QTextStream(stderr) << "Error: No input files." << Qt::endl;
QTextStream(stderr) << "Error: No input files." << le_endl;
return 1;
}
else {
@ -62,7 +68,7 @@ int main(int argc, char *argv[])
QFile luaScript(inputFile);
if (!luaScript.open(QIODevice::ReadOnly)) {
QTextStream(stderr) << "Error: Failed to open \"" << inputFile << "\"." << Qt::endl;
QTextStream(stderr) << "Error: Failed to open \"" << inputFile << "\"." << le_endl;
return 1;
}
@ -75,13 +81,13 @@ int main(int argc, char *argv[])
LuaEngine luaEngine;
if (!luaEngine.loadLuaScript(luaScript.readAll())) {
QTextStream(stderr) << "Error: Failed to load \"" << inputFile << "\"." << Qt::endl;
QTextStream(stderr) << "Error: Failed to load \"" << inputFile << "\"." << le_endl;
return 1;
}
QSaveFile outputSaveFile(outputFile);
if (!outputSaveFile.open(QIODevice::WriteOnly)) {
QTextStream(stderr) << "Error: Failed to open \"" << outputFile << "\"." << Qt::endl;
QTextStream(stderr) << "Error: Failed to open \"" << outputFile << "\"." << le_endl;
return 1;
}
@ -91,7 +97,7 @@ int main(int argc, char *argv[])
if (!portableLuaEngine.open(QIODevice::ReadOnly)) {
outputSaveFile.cancelWriting();
outputSaveFile.commit();
QTextStream(stderr) << "Error: Failed to open \"" << pLuaEngine << "\"." << Qt::endl;
QTextStream(stderr) << "Error: Failed to open \"" << pLuaEngine << "\"." << le_endl;
return 1;
}
outputSaveFile.write(portableLuaEngine.readAll());
@ -106,7 +112,7 @@ int main(int argc, char *argv[])
if (lengthArray.size() > 8) {
outputSaveFile.cancelWriting();
outputSaveFile.commit();
QTextStream(stderr) << "Error: Lua Engine script is too large." << Qt::endl;
QTextStream(stderr) << "Error: Lua Engine script is too large." << le_endl;
return 1;
}
else {
@ -119,7 +125,7 @@ int main(int argc, char *argv[])
}
if (!outputSaveFile.commit()) {
QTextStream(stderr) << "Error: Failed to write \"" << args.at(1) << "\"." << Qt::endl;
QTextStream(stderr) << "Error: Failed to write \"" << args.at(1) << "\"." << le_endl;
return 1;
}