overlays: simplify backup icon copy procedure

This commit is contained in:
Megamouse 2021-07-28 17:17:45 +02:00
parent e5eb727110
commit 7eee9e7b05
1 changed files with 5 additions and 15 deletions

View File

@ -74,12 +74,13 @@ namespace rsx
for (const auto &res : texture_resource_files)
{
// 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)
{
// 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());
#ifndef _WIN32
// Check for Icons in ../share/rpcs3 for AppImages,
@ -133,19 +134,8 @@ namespace rsx
if (info->data != nullptr)
{
// Install the image to config dir
auto dst_dir = fs::get_config_dir() + "Icons/ui/";
auto dst = dst_dir + res;
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);
fs::create_path(image_path);
fs::copy_file(src, image_path, true);
}
}