From 2a1127d7e8a369df12bbbf7588de3bd82464db06 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Fri, 24 May 2019 23:25:03 +0200 Subject: [PATCH] Show acceptable icon sizes in error message CC #75. --- src/core/appdir.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/appdir.cpp b/src/core/appdir.cpp index 435a218..7cffcb8 100644 --- a/src/core/appdir.cpp +++ b/src/core/appdir.cpp @@ -526,13 +526,27 @@ namespace linuxdeploy { invalidYRes = false; } + auto printIconHint = [&knownResolutions]() { + std::stringstream ss; + for (const auto res : knownResolutions) { + ss << res << "x" << res; + + if (res != *(knownResolutions.end() - 1)) + ss << ", "; + } + + ldLog() << LD_ERROR << "Valid resolutions for icons are:" << ss.str() << std::endl; + }; + if (invalidXRes) { ldLog() << LD_ERROR << "Icon" << path << "has invalid x resolution:" << xRes << std::endl; + printIconHint(); return false; } if (invalidYRes) { ldLog() << LD_ERROR << "Icon" << path << "has invalid y resolution:" << yRes << std::endl; + printIconHint(); return false; } } catch (const CImgException& e) {