mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Log error if file open/commit fails (#5235)
This commit is contained in:
commit
f91accdce8
23 changed files with 54 additions and 44 deletions
|
|
@ -618,7 +618,7 @@ bool PackInstallTask::createPackComponent(QString instanceRoot, PackProfile* pro
|
|||
|
||||
QFile file(patchFileName);
|
||||
if (!file.open(QFile::WriteOnly)) {
|
||||
qCritical() << "Error opening" << file.fileName() << "for reading:" << file.errorString();
|
||||
qCritical() << "Error opening" << file.fileName() << "for writing:" << file.errorString();
|
||||
return false;
|
||||
}
|
||||
file.write(OneSixVersionFormat::versionFileToJson(f).toJson());
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void createOverrides(const QString& name, const QString& parent_folder, const QS
|
|||
|
||||
QFile file(file_path);
|
||||
if (!file.open(QFile::WriteOnly)) {
|
||||
qWarning() << "Failed to open file '" << file.fileName() << "' for writing!";
|
||||
qWarning() << "Failed to open file" << file.fileName() << "for writing:" << file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ QStringList readOverrides(const QString& name, const QString& parent_folder)
|
|||
QStringList previous_overrides;
|
||||
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qWarning() << "Failed to open file '" << file.fileName() << "' for reading!";
|
||||
qWarning() << "Failed to open file" << file.fileName() << "for reading:" << file.errorString();
|
||||
return previous_overrides;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ void PackInstallTask::install()
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Failed to open file '" << packJson.fileName() << "' for reading!";
|
||||
qWarning() << "Failed to open file" << packJson.fileName() << "for reading:" << packJson.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,13 +108,13 @@ void ModrinthPackExportTask::collectHashes()
|
|||
|
||||
QFile openFile(file.absoluteFilePath());
|
||||
if (!openFile.open(QFile::ReadOnly)) {
|
||||
qWarning() << "Could not open" << file << "for hashing";
|
||||
qWarning() << "Could not open" << file << "for hashing:" << openFile.errorString();
|
||||
continue;
|
||||
}
|
||||
|
||||
const QByteArray data = openFile.readAll();
|
||||
if (openFile.error() != QFileDevice::NoError) {
|
||||
qWarning() << "Could not read" << file;
|
||||
qWarning() << "Could not read" << file << "error:" << openFile.errorString();
|
||||
continue;
|
||||
}
|
||||
auto sha512 = Hashing::hash(data, Hashing::Algorithm::Sha512);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void V1::updateModIndex(const QDir& index_dir, Mod& mod)
|
|||
}
|
||||
|
||||
if (!index_file.open(QIODevice::ReadWrite)) {
|
||||
qCritical() << QString("Could not open file %1!").arg(normalized_fname);
|
||||
qCritical() << "Could not open file" << normalized_fname << "error:" << index_file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void Technic::TechnicPackProcessor::run(SettingsObject* globalSettings,
|
|||
} else if (QFile::exists(versionJson)) {
|
||||
QFile file(versionJson);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
emit failed(tr("Unable to open \"version.json\"!"));
|
||||
emit failed(tr("Unable to open \"version.json\": %1").arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
data = file.readAll();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue