mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-11-05 05:26:55 +01:00
Fix luaenginec legacy build
This commit is contained in:
parent
51b3694661
commit
7603ed4160
1 changed files with 13 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue