mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
Prefer BDVD over HDD0 in vfs::retrieve
This commit is contained in:
parent
d22b8b1d3a
commit
dc48944979
@ -304,7 +304,7 @@ lv2_file::lv2_file(utils::serial& ar)
|
|||||||
void lv2_file::save(utils::serial& ar)
|
void lv2_file::save(utils::serial& ar)
|
||||||
{
|
{
|
||||||
USING_SERIALIZATION_VERSION(lv2_fs);
|
USING_SERIALIZATION_VERSION(lv2_fs);
|
||||||
ar(name, mode, flags, type, lock, vfs::retrieve(real_path));
|
ar(name, mode, flags, type, lock, ensure(vfs::retrieve(real_path), FN(!x.empty())));
|
||||||
|
|
||||||
if (!(mp->flags & lv2_mp_flag::read_only) && flags & CELL_FS_O_ACCMODE)
|
if (!(mp->flags & lv2_mp_flag::read_only) && flags & CELL_FS_O_ACCMODE)
|
||||||
{
|
{
|
||||||
|
@ -388,13 +388,23 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
|
|||||||
// Try to extract host root mount point name (if exists)
|
// Try to extract host root mount point name (if exists)
|
||||||
std::string_view host_root_name;
|
std::string_view host_root_name;
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
std::string result_dir;
|
||||||
|
|
||||||
for (const auto& [name, dir] : node->dirs)
|
for (const auto& [name, dir] : node->dirs)
|
||||||
{
|
{
|
||||||
mount_path->back() = name;
|
mount_path->back() = name;
|
||||||
|
|
||||||
if (std::string res = vfs::retrieve(path, &dir, mount_path); !res.empty())
|
if (std::string res = vfs::retrieve(path, &dir, mount_path); !res.empty())
|
||||||
{
|
{
|
||||||
return res;
|
// Avoid app_home
|
||||||
|
// Prefer dev_bdvd over dev_hdd0
|
||||||
|
if (result.empty() || (name == "app_home") < (result_dir == "app_home") ||
|
||||||
|
(name == "dev_bdvd") > (result_dir == "dev_bdvd"))
|
||||||
|
{
|
||||||
|
result = std::move(res);
|
||||||
|
result_dir = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir.path == "/"sv)
|
if (dir.path == "/"sv)
|
||||||
@ -403,6 +413,11 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!result.empty())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
mount_path->pop_back();
|
mount_path->pop_back();
|
||||||
|
|
||||||
if (node->path.size() > 1 && path.starts_with(node->path))
|
if (node->path.size() > 1 && path.starts_with(node->path))
|
||||||
@ -434,7 +449,7 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
|
|||||||
{
|
{
|
||||||
// If failed to find mount point for path and /host_root is mounted
|
// If failed to find mount point for path and /host_root is mounted
|
||||||
// Prepend "/host_root" to path and return the constructed string
|
// Prepend "/host_root" to path and return the constructed string
|
||||||
std::string result{"/"};
|
result = "/";
|
||||||
|
|
||||||
for (const auto& name : *mount_path)
|
for (const auto& name : *mount_path)
|
||||||
{
|
{
|
||||||
@ -449,7 +464,7 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string vfs::escape(std::string_view name, bool escape_slash)
|
std::string vfs::escape(std::string_view name, bool escape_slash)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user