diff --git a/WallReel/Core/Service/manager.cpp b/WallReel/Core/Service/manager.cpp index bd1345e..de609b1 100644 --- a/WallReel/Core/Service/manager.cpp +++ b/WallReel/Core/Service/manager.cpp @@ -1,5 +1,6 @@ #include "manager.hpp" +#include "Utils/misc.hpp" #include "Utils/texttemplate.hpp" #include "logger.hpp" @@ -61,6 +62,8 @@ void Manager::selectWallpaper(const QString& id) { return; } + Utils::printPath(data->getFullPath()); + const auto command = _renderCommand(m_actionConfig.onSelected, _generateVariables(*data)); m_wallpaperService->select(command); } diff --git a/WallReel/Core/Utils/misc.hpp b/WallReel/Core/Utils/misc.hpp index d3fa83d..6052c8c 100644 --- a/WallReel/Core/Utils/misc.hpp +++ b/WallReel/Core/Utils/misc.hpp @@ -179,6 +179,24 @@ inline QDir getPicturesDir() { return QDir(picturesDir); } +inline void printPath(const QString& path, std::FILE* out = stdout) { + if (path.isEmpty()) { + return; + } + + const QByteArray bytes = QFile::encodeName(path); + + const size_t n = static_cast(bytes.size()); + if (std::fwrite(bytes.constData(), 1, n, out) != n) { + return; + } + if (std::fputc('\n', out) == EOF) { + return; + } + std::fflush(out); + return; +} + } // namespace WallReel::Core::Utils #endif // WALLREEL_MISC_HPP