mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
fs: Reimplement path resolving using std::filesystem::weakly_canonical
This commit is contained in:
parent
8c9090fd03
commit
0c4b2ff06b
6 changed files with 45 additions and 21 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "Crypto/sha1.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <filesystem>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
|
@ -1822,6 +1823,20 @@ bool fs::remove_all(const std::string& path, bool remove_root)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string fs::resolve_path(std::string_view path)
|
||||
{
|
||||
std::error_code ec{};
|
||||
const auto result = std::filesystem::weakly_canonical(std::filesystem::path(path), ec);
|
||||
|
||||
if (ec)
|
||||
{
|
||||
g_tls_error = error::inval;
|
||||
return {};
|
||||
}
|
||||
|
||||
return result.string();
|
||||
}
|
||||
|
||||
u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment)
|
||||
{
|
||||
u64 result = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue