overlays: simplify backup icon copy procedure

This commit is contained in:
Megamouse 2021-07-28 17:17:45 +02:00
parent e5eb727110
commit 7eee9e7b05

View File

@ -74,12 +74,13 @@ namespace rsx
for (const auto &res : texture_resource_files) for (const auto &res : texture_resource_files)
{ {
// First check the global config dir // First check the global config dir
auto info = std::make_unique<image_info>((fs::get_config_dir() + "Icons/ui/" + res).c_str()); const std::string image_path = fs::get_config_dir() + "Icons/ui/" + res;
auto info = std::make_unique<image_info>(image_path.c_str());
if (info->data == nullptr) if (info->data == nullptr)
{ {
// Resource was not found in config dir, try and grab from relative path (linux) // Resource was not found in config dir, try and grab from relative path (linux)
auto 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.c_str());
#ifndef _WIN32 #ifndef _WIN32
// Check for Icons in ../share/rpcs3 for AppImages, // Check for Icons in ../share/rpcs3 for AppImages,
@ -133,19 +134,8 @@ namespace rsx
if (info->data != nullptr) if (info->data != nullptr)
{ {
// Install the image to config dir // Install the image to config dir
auto dst_dir = fs::get_config_dir() + "Icons/ui/"; fs::create_path(image_path);
auto dst = dst_dir + res; fs::copy_file(src, image_path, true);
if (!fs::is_dir(dst_dir))
{
auto root_folder = fs::get_config_dir() + "Icons/";
if (!fs::is_dir(root_folder))
fs::create_dir(root_folder);
fs::create_dir(dst_dir);
}
fs::copy_file(src, dst, true);
} }
} }