diff options
author | Oliver Wolff <oliver.wolff@digia.com> | 2012-10-04 10:26:52 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-04 12:55:16 +0200 |
commit | 0b8cf818136ad9145385acddcee838480946a121 (patch) | |
tree | d4b3a2853827aeb8396bc354a3a691c2d45974b6 | |
parent | 6d3aae3fb612071de42a2b6fb4087482b1e2ceb8 (diff) |
Be more verbose about error when using shared.h for examples
Instead of just aborting the program it should at least give a hint
about what actually went wrong.
Change-Id: I4019b3c026ba1777905f457562bdc77e5c05df4f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r-- | examples/shared/shared.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/examples/shared/shared.h b/examples/shared/shared.h index 613798f078..0e9395a108 100644 --- a/examples/shared/shared.h +++ b/examples/shared/shared.h @@ -48,18 +48,26 @@ if (QGuiApplication::platformName() == QLatin1String("windows")) {\ if (directory.absolutePath().endsWith("/debug", Qt::CaseInsensitive)\ || directory.absolutePath().endsWith("/release", Qt::CaseInsensitive))\ - if (!directory.cdUp())\ - exit(-1);\ + if (!directory.cdUp()) {\ + qWarning("Could not change to parent directory of '%s'",\ + qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ + return -1;\ + }\ } else if (QGuiApplication::platformName() == QLatin1String("Cocoa")) {\ if (directory.absolutePath().endsWith(#NAME".app/Contents/MacOS"))\ for (int i = 0; i < 3; ++i) {\ - if (!directory.cdUp())\ - exit(-1);\ + if (!directory.cdUp()) {\ + qWarning("Could not change to parent directory of '%s'",\ + qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ + return -1;\ + }\ }\ }\ const QString fileName(directory.absolutePath() + "/" #NAME ".qml");\ - if (!QFile::exists(fileName))\ - exit(-1);\ + if (!QFile::exists(fileName)) {\ + qWarning("Could not find file '%s'", qPrintable(QDir::toNativeSeparators(fileName)));\ + return -1;\ + }\ view.setSource(QUrl::fromLocalFile(fileName));\ view.show();\ return app.exec();\ |