mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Get rid of unneeded QTextStream from GenerateDesktopFile
This commit is contained in:
parent
ace363f432
commit
4484edd212
1 changed files with 10 additions and 8 deletions
|
@ -422,13 +422,15 @@ bool GenerateDesktopFile(
|
||||||
const auto sourceFile = kDesktopFile.utf16();
|
const auto sourceFile = kDesktopFile.utf16();
|
||||||
const auto targetFile = targetPath + QGuiApplication::desktopFileName();
|
const auto targetFile = targetPath + QGuiApplication::desktopFileName();
|
||||||
|
|
||||||
QString fileText;
|
const auto sourceText = [&] {
|
||||||
QFile source(sourceFile);
|
QFile source(sourceFile);
|
||||||
if (source.open(QIODevice::ReadOnly)) {
|
if (source.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream s(&source);
|
return source.readAll().toStdString();
|
||||||
fileText = s.readAll();
|
}
|
||||||
source.close();
|
return std::string();
|
||||||
} else {
|
}();
|
||||||
|
|
||||||
|
if (sourceText.empty()) {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
LOG(("App Error: Could not open '%1' for read").arg(sourceFile));
|
LOG(("App Error: Could not open '%1' for read").arg(sourceFile));
|
||||||
}
|
}
|
||||||
|
@ -438,7 +440,7 @@ bool GenerateDesktopFile(
|
||||||
try {
|
try {
|
||||||
const auto target = Glib::KeyFile::create();
|
const auto target = Glib::KeyFile::create();
|
||||||
target->load_from_data(
|
target->load_from_data(
|
||||||
fileText.toStdString(),
|
sourceText,
|
||||||
Glib::KeyFile::Flags::KEEP_COMMENTS
|
Glib::KeyFile::Flags::KEEP_COMMENTS
|
||||||
| Glib::KeyFile::Flags::KEEP_TRANSLATIONS);
|
| Glib::KeyFile::Flags::KEEP_TRANSLATIONS);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue