diff --git a/src/core/desktopfile.cpp b/src/core/desktopfile.cpp index d4ef4a9..9796398 100644 --- a/src/core/desktopfile.cpp +++ b/src/core/desktopfile.cpp @@ -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; + } } }; diff --git a/src/core/main.cpp b/src/core/main.cpp index 0dce190..19b1ed6 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -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()) {