overlays: use std::string instead of raw path argument

It will be converted to string anyway
This commit is contained in:
Megamouse 2025-03-18 23:13:06 +01:00
parent cd25e91321
commit 12eacfa67b
7 changed files with 12 additions and 12 deletions

View file

@ -62,7 +62,7 @@ namespace rsx
if (fs::exists(avatar_path)) if (fs::exists(avatar_path))
{ {
icon_data = std::make_unique<image_info>(avatar_path.c_str()); icon_data = std::make_unique<image_info>(avatar_path);
static_cast<image_view*>(image.get())->set_raw_image(icon_data.get()); static_cast<image_view*>(image.get())->set_raw_image(icon_data.get());
} }
else else

View file

@ -31,7 +31,7 @@ namespace rsx
if (fs::exists(icon_path)) if (fs::exists(icon_path))
{ {
icon_data = std::make_unique<image_info>(icon_path.c_str(), details.hidden || locked); icon_data = std::make_unique<image_info>(icon_path, details.hidden || locked);
static_cast<image_view*>(image.get())->set_raw_image(icon_data.get()); static_cast<image_view*>(image.get())->set_raw_image(icon_data.get());
} }
else else

View file

@ -12,7 +12,7 @@ namespace rsx
animated_icon::animated_icon(const char* icon_name) animated_icon::animated_icon(const char* icon_name)
{ {
const std::string image_path = fmt::format("%s/Icons/ui/%s", fs::get_config_dir(), icon_name); const std::string image_path = fmt::format("%s/Icons/ui/%s", fs::get_config_dir(), icon_name);
m_icon = std::make_unique<image_info>(image_path.c_str()); m_icon = std::make_unique<image_info>(image_path);
set_raw_image(m_icon.get()); set_raw_image(m_icon.get());
} }

View file

@ -54,7 +54,7 @@ namespace rsx
return result; return result;
} }
image_info::image_info(const char* filename, bool grayscaled) image_info::image_info(const std::string& filename, bool grayscaled)
{ {
fs::file f(filename, fs::read + fs::isfile); fs::file f(filename, fs::read + fs::isfile);
@ -132,7 +132,7 @@ namespace rsx
{ {
// First check the global config dir // First check the global config dir
const std::string image_path = fs::get_config_dir() + "Icons/ui/" + res; const std::string image_path = fs::get_config_dir() + "Icons/ui/" + res;
auto info = std::make_unique<image_info>(image_path.c_str()); auto info = std::make_unique<image_info>(image_path);
#if !defined(_WIN32) && !defined(__APPLE__) && defined(DATADIR) #if !defined(_WIN32) && !defined(__APPLE__) && defined(DATADIR)
// Check the DATADIR if defined // Check the DATADIR if defined
@ -140,7 +140,7 @@ namespace rsx
{ {
const std::string data_dir (DATADIR); const std::string data_dir (DATADIR);
const std::string image_data = data_dir + "/Icons/ui/" + res; const std::string image_data = data_dir + "/Icons/ui/" + res;
info = std::make_unique<image_info>(image_data.c_str()); info = std::make_unique<image_info>(image_data);
} }
#endif #endif
@ -148,7 +148,7 @@ namespace rsx
{ {
// Resource was not found in the DATADIR or config dir, try and grab from relative path (linux) // Resource was not found in the DATADIR or config dir, try and grab from relative path (linux)
std::string src = "Icons/ui/" + res; std::string src = "Icons/ui/" + res;
info = std::make_unique<image_info>(src.c_str()); info = std::make_unique<image_info>(src);
#ifndef _WIN32 #ifndef _WIN32
// Check for Icons in ../share/rpcs3 for AppImages, // Check for Icons in ../share/rpcs3 for AppImages,
// in rpcs3.app/Contents/Resources for App Bundles, and /usr/bin. // in rpcs3.app/Contents/Resources for App Bundles, and /usr/bin.
@ -188,12 +188,12 @@ namespace rsx
#else #else
src = executablePath + "/../share/rpcs3/Icons/ui/" + res; src = executablePath + "/../share/rpcs3/Icons/ui/" + res;
#endif #endif
info = std::make_unique<image_info>(src.c_str()); info = std::make_unique<image_info>(src);
// Check if the icons are in the same directory as the executable (local builds) // Check if the icons are in the same directory as the executable (local builds)
if (info->get_data() == nullptr) if (info->get_data() == nullptr)
{ {
src = executablePath + "/Icons/ui/" + res; src = executablePath + "/Icons/ui/" + res;
info = std::make_unique<image_info>(src.c_str()); info = std::make_unique<image_info>(src);
} }
} }
} }

View file

@ -41,7 +41,7 @@ namespace rsx
int bpp = 0; int bpp = 0;
image_info(image_info&) = delete; image_info(image_info&) = delete;
image_info(const char* filename, bool grayscaled = false); image_info(const std::string& filename, bool grayscaled = false);
image_info(const std::vector<u8>& bytes, bool grayscaled = false); image_info(const std::vector<u8>& bytes, bool grayscaled = false);
~image_info(); ~image_info();

View file

@ -58,7 +58,7 @@ namespace rsx
} }
} }
icon_data = std::make_unique<image_info>(entry.info.path.c_str()); icon_data = std::make_unique<image_info>(entry.info.path);
static_cast<image_view*>(image.get())->set_raw_image(icon_data.get()); static_cast<image_view*>(image.get())->set_raw_image(icon_data.get());
} }
else else

View file

@ -17,7 +17,7 @@ namespace rsx
if (fs::exists(avatar_path)) if (fs::exists(avatar_path))
{ {
icon_data = std::make_unique<image_info>(avatar_path.c_str()); icon_data = std::make_unique<image_info>(avatar_path);
static_cast<image_view*>(image.get())->set_raw_image(icon_data.get()); static_cast<image_view*>(image.get())->set_raw_image(icon_data.get());
} }
else else