mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-06-01 12:15:27 -06:00
Qt: log error cause on shortcut icon creation
This commit is contained in:
parent
461862be46
commit
cc19685207
@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QImageWriter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
@ -49,13 +50,14 @@ namespace gui::utils
|
|||||||
QFile icon_file(QString::fromStdString(target_icon_path));
|
QFile icon_file(QString::fromStdString(target_icon_path));
|
||||||
if (!icon_file.open(QFile::OpenModeFlag::ReadWrite | QFile::OpenModeFlag::Truncate))
|
if (!icon_file.open(QFile::OpenModeFlag::ReadWrite | QFile::OpenModeFlag::Truncate))
|
||||||
{
|
{
|
||||||
sys_log.error("Failed to create icon file: %s", target_icon_path);
|
sys_log.error("Failed to create icon file '%s': %s", target_icon_path, icon_file.errorString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!icon.save(&icon_file, fmt::to_upper(extension).c_str()))
|
// Use QImageWriter instead of QPixmap::save in order to be able to log errors
|
||||||
|
if (QImageWriter writer(&icon_file, fmt::to_upper(extension).c_str()); !writer.write(icon.toImage()))
|
||||||
{
|
{
|
||||||
sys_log.error("Failed to write icon file: %s", target_icon_path);
|
sys_log.error("Failed to write icon file '%s': %s", target_icon_path, writer.errorString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,8 +232,8 @@ namespace gui::utils
|
|||||||
fmt::append(link_path, "/%s.app", simple_name);
|
fmt::append(link_path, "/%s.app", simple_name);
|
||||||
|
|
||||||
const std::string contents_dir = link_path + "/Contents/";
|
const std::string contents_dir = link_path + "/Contents/";
|
||||||
const std::string macos_dir = contents_dir + "/MacOS/";
|
const std::string macos_dir = contents_dir + "MacOS/";
|
||||||
const std::string resources_dir = contents_dir + "/Resources/";
|
const std::string resources_dir = contents_dir + "Resources/";
|
||||||
|
|
||||||
if (!fs::create_path(contents_dir) || !fs::create_path(macos_dir) || !fs::create_path(resources_dir))
|
if (!fs::create_path(contents_dir) || !fs::create_path(macos_dir) || !fs::create_path(resources_dir))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user