mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-04-13 15:19:49 -05:00
Improve desktop file related messages
This commit is contained in:
@@ -101,11 +101,23 @@ namespace linuxdeploy {
|
||||
}
|
||||
|
||||
bool DesktopFile::addDefaultKeys(const std::string& executableFileName) {
|
||||
ldLog() << "Adding default values to desktop file:" << path() << std::endl;
|
||||
|
||||
auto rv = true;
|
||||
|
||||
auto setDefault = [&rv, this](const std::string& section, const std::string& key, const std::string& value) {
|
||||
if (setEntry(section, key, value)) {
|
||||
if (entryExists(section, key)) {
|
||||
std::string currentValue;
|
||||
if (!getEntry(section, key, currentValue))
|
||||
ldLog() << LD_ERROR << "This should never happen" << std::endl;
|
||||
|
||||
ldLog() << LD_WARNING << "Key exists, not modified:" << key << "(current value:" << currentValue << LD_NO_SPACE << ")" << std::endl;
|
||||
rv = false;
|
||||
} else {
|
||||
if (setEntry(section, key, value)) {
|
||||
// *should* be unreachable
|
||||
rv = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
ldLog() << std::endl << "-- Creating desktop file --" << std::endl;
|
||||
ldLog() << LD_WARNING << "Please beware the created desktop file is of low quality and should be edited or replaced before using it for production releases!" << std::endl;
|
||||
|
||||
auto executableName = bf::path(executablePaths.Get().front()).filename().string();
|
||||
|
||||
@@ -176,7 +177,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
desktopfile::DesktopFile desktopFile(desktopFilePath);
|
||||
if (!desktopFile.addDefaultKeys(executableName)) {
|
||||
ldLog() << LD_WARNING << "Tried to overwrite existing entries in desktop file" << std::endl;
|
||||
ldLog() << LD_WARNING << "Tried to overwrite existing entries in desktop file:" << desktopFilePath << std::endl;
|
||||
}
|
||||
|
||||
if (!desktopFile.save()) {
|
||||
|
||||
Reference in New Issue
Block a user