filesystem: use std for PathExists

Remove custom platform implementation of `PathExists` and replace uses
with `std::filesystem::exists`.
This commit is contained in:
Sandy Carter
2020-04-09 10:09:18 -04:00
committed by Rick Gibbed
parent a9fa38c88b
commit c8e64da4eb
12 changed files with 23 additions and 36 deletions

View File

@@ -26,7 +26,7 @@ HostPathDevice::HostPathDevice(const std::string_view mount_path,
HostPathDevice::~HostPathDevice() = default;
bool HostPathDevice::Initialize() {
if (!xe::filesystem::PathExists(host_path_)) {
if (!std::filesystem::exists(host_path_)) {
if (!read_only_) {
// Create the path.
xe::filesystem::CreateFolder(host_path_);

View File

@@ -61,13 +61,14 @@ StfsContainerDevice::~StfsContainerDevice() = default;
bool StfsContainerDevice::Initialize() {
// Resolve a valid STFS file if a directory is given.
if (std::filesystem::is_directory(host_path_) && !ResolveFromFolder(host_path_)) {
if (std::filesystem::is_directory(host_path_) &&
!ResolveFromFolder(host_path_)) {
XELOGE("Could not resolve an STFS container given path {}",
xe::path_to_utf8(host_path_));
return false;
}
if (!filesystem::PathExists(host_path_)) {
if (!std::filesystem::exists(host_path_)) {
XELOGE("Path to STFS container does not exist: {}",
xe::path_to_utf8(host_path_));
return false;
@@ -120,7 +121,7 @@ StfsContainerDevice::Error StfsContainerDevice::MapFiles() {
// If the STFS package is multi-file, it is an SVOD system. We need to map
// the files in the .data folder and can discard the header.
auto data_fragment_path = host_path_ / ".data";
if (!filesystem::PathExists(data_fragment_path)) {
if (!std::filesystem::exists(data_fragment_path)) {
XELOGE("STFS container is multi-file, but path {} does not exist.",
xe::path_to_utf8(data_fragment_path));
return Error::kErrorFileMismatch;
@@ -778,4 +779,4 @@ bool StfsContainerDevice::ResolveFromFolder(const std::filesystem::path& path) {
}
} // namespace vfs
} // namespace xe
} // namespace xe