diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-08-22 13:59:00 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-08-22 12:44:35 +0000 |
commit | 19cbd1ac4876db6da32e5b61898c7e68049138fe (patch) | |
tree | d615e331a74c65922d12659504a12598c846ba9b | |
parent | de7e0c58f89deaa99cae589fdd26fa2984f47f72 (diff) | |
download | qt-creator-19cbd1ac4876db6da32e5b61898c7e68049138fe.tar.gz |
Sdktool: Report settings write errors instead of silently failing
Change-Id: Icf344652593bc868dce8f66e8f4ab11970c87204
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | src/tools/sdktool/operation.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/tools/sdktool/operation.cpp b/src/tools/sdktool/operation.cpp index 8a21983db0..c4f823281a 100644 --- a/src/tools/sdktool/operation.cpp +++ b/src/tools/sdktool/operation.cpp @@ -126,8 +126,18 @@ bool Operation::save(const QVariantMap &map, const QString &file) const Utils::PersistentSettingsWriter writer(path, QLatin1String("QtCreator") + file[0].toUpper() + file.mid(1)); - return writer.save(map, 0) - && QFile::setPermissions(path.toString(), - QFile::ReadOwner | QFile::WriteOwner - | QFile::ReadGroup | QFile::ReadOther); + QString errorMessage; + if (!writer.save(map, &errorMessage)) { + std::cerr << "Error: Could not save settings " << qPrintable(path.toString()) + << "." << std::endl; + return false; + } + if (!QFile::setPermissions(path.toString(), + QFile::ReadOwner | QFile::WriteOwner + | QFile::ReadGroup | QFile::ReadOther)) { + std::cerr << "Error: Could not set permissions for " << qPrintable(path.toString()) + << "." << std::endl; + return false; + } + return true; } |