mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 00:39:23 +01:00
VideoCommon: update DirectFilesystemAssetLibrary to not throw exceptions when a file no longer exists
This commit is contained in:
parent
429b2eca8a
commit
afa498fa2f
@ -4,6 +4,7 @@
|
|||||||
#include "VideoCommon/Assets/DirectFilesystemAssetLibrary.h"
|
#include "VideoCommon/Assets/DirectFilesystemAssetLibrary.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <fmt/os.h>
|
||||||
|
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
@ -35,7 +36,10 @@ DirectFilesystemAssetLibrary::GetLastAssetWriteTime(const AssetID& asset_id) con
|
|||||||
CustomAssetLibrary::TimeType max_entry;
|
CustomAssetLibrary::TimeType max_entry;
|
||||||
for (const auto& [key, value] : asset_map_path)
|
for (const auto& [key, value] : asset_map_path)
|
||||||
{
|
{
|
||||||
const auto tp = std::filesystem::last_write_time(value);
|
std::error_code ec;
|
||||||
|
const auto tp = std::filesystem::last_write_time(value, ec);
|
||||||
|
if (ec)
|
||||||
|
continue;
|
||||||
if (tp > max_entry)
|
if (tp > max_entry)
|
||||||
max_entry = tp;
|
max_entry = tp;
|
||||||
}
|
}
|
||||||
@ -59,7 +63,14 @@ CustomAssetLibrary::LoadInfo DirectFilesystemAssetLibrary::LoadTexture(const Ass
|
|||||||
}
|
}
|
||||||
const auto& asset_path = asset_map.begin()->second;
|
const auto& asset_path = asset_map.begin()->second;
|
||||||
|
|
||||||
const auto last_loaded_time = std::filesystem::last_write_time(asset_path);
|
std::error_code ec;
|
||||||
|
const auto last_loaded_time = std::filesystem::last_write_time(asset_path, ec);
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(VIDEO, "Asset '{}' error - failed to get last write time with error '{}'!",
|
||||||
|
asset_id, ec);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
auto ext = asset_path.extension().string();
|
auto ext = asset_path.extension().string();
|
||||||
Common::ToLower(&ext);
|
Common::ToLower(&ext);
|
||||||
if (ext == ".dds")
|
if (ext == ".dds")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user