diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 8ff73e83f..742b6473a 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -352,7 +352,7 @@ void EmulatorWindow::ShowContentDirectory() { } if (!std::filesystem::exists(target_path)) { - xe::filesystem::CreateFolder(target_path); + std::filesystem::create_directories(target_path); } LaunchFileExplorer(target_path); diff --git a/src/xenia/base/filesystem.cc b/src/xenia/base/filesystem.cc index 861b81951..d7b7b647d 100644 --- a/src/xenia/base/filesystem.cc +++ b/src/xenia/base/filesystem.cc @@ -18,7 +18,7 @@ bool CreateParentFolder(const std::filesystem::path& path) { if (path.has_parent_path()) { auto parent_path = path.parent_path(); if (!std::filesystem::exists(parent_path)) { - return CreateFolder(parent_path); + return std::filesystem::create_directories(parent_path); } } return true; diff --git a/src/xenia/base/filesystem.h b/src/xenia/base/filesystem.h index 5da5ad941..a2d11458e 100644 --- a/src/xenia/base/filesystem.h +++ b/src/xenia/base/filesystem.h @@ -41,10 +41,6 @@ std::filesystem::path GetUserFolder(); // attempting to create it. bool CreateParentFolder(const std::filesystem::path& path); -// Creates a folder at the specified path. -// Returns true if the path was created. -bool CreateFolder(const std::filesystem::path& path); - // Recursively deletes the files and folders at the specified path. // Returns true if the path was found and removed. bool DeleteFolder(const std::filesystem::path& path); diff --git a/src/xenia/base/filesystem_posix.cc b/src/xenia/base/filesystem_posix.cc index 44cdeff13..e26e55250 100644 --- a/src/xenia/base/filesystem_posix.cc +++ b/src/xenia/base/filesystem_posix.cc @@ -106,10 +106,6 @@ bool TruncateStdioFile(FILE* file, uint64_t length) { return true; } -bool CreateFolder(const std::filesystem::path& path) { - return mkdir(path.c_str(), 0774); -} - static int removeCallback(const char* fpath, const struct stat* sb, int typeflag, struct FTW* ftwbuf) { int rv = remove(fpath); diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc index 7910d6ff4..ddc80d2ab 100644 --- a/src/xenia/base/filesystem_win.cc +++ b/src/xenia/base/filesystem_win.cc @@ -61,15 +61,6 @@ std::filesystem::path GetUserFolder() { return result; } -bool CreateFolder(const std::filesystem::path& path) { - std::filesystem::path create_path; - for (auto it = path.begin(); it != path.end(); ++it) { - create_path /= *it; - CreateDirectoryW(create_path.c_str(), nullptr); - } - return std::filesystem::exists(path); -} - bool DeleteFolder(const std::filesystem::path& path) { auto double_null_path = path.wstring() + std::wstring(L"\0", 1); SHFILEOPSTRUCT op = {0}; diff --git a/src/xenia/gpu/d3d12/pipeline_cache.cc b/src/xenia/gpu/d3d12/pipeline_cache.cc index a13acb61a..be7ac0e6a 100644 --- a/src/xenia/gpu/d3d12/pipeline_cache.cc +++ b/src/xenia/gpu/d3d12/pipeline_cache.cc @@ -202,7 +202,7 @@ void PipelineCache::InitializeShaderStorage( // cost - though D3D's internal validation would possibly be enough to ensure // they are up to date). auto shader_storage_shareable_root = shader_storage_root / "shareable"; - if (!xe::filesystem::CreateFolder(shader_storage_shareable_root)) { + if (!std::filesystem::create_directories(shader_storage_shareable_root)) { return; } diff --git a/src/xenia/gpu/shader.cc b/src/xenia/gpu/shader.cc index 15d59c375..1a3a6cce6 100644 --- a/src/xenia/gpu/shader.cc +++ b/src/xenia/gpu/shader.cc @@ -47,7 +47,7 @@ std::pair Shader::Dump( auto target_path = base_path; if (!target_path.empty()) { target_path = std::filesystem::absolute(target_path); - xe::filesystem::CreateFolder(target_path); + std::filesystem::create_directories(target_path); } auto base_name = diff --git a/src/xenia/gpu/trace_writer.cc b/src/xenia/gpu/trace_writer.cc index d2d0e52fb..b978fdcc9 100644 --- a/src/xenia/gpu/trace_writer.cc +++ b/src/xenia/gpu/trace_writer.cc @@ -33,7 +33,7 @@ bool TraceWriter::Open(const std::filesystem::path& path, uint32_t title_id) { auto canonical_path = std::filesystem::absolute(path); if (canonical_path.has_parent_path()) { auto base_path = canonical_path.parent_path(); - xe::filesystem::CreateFolder(base_path); + std::filesystem::create_directories(base_path); } file_ = xe::filesystem::OpenFile(canonical_path, "wb"); diff --git a/src/xenia/kernel/xam/content_manager.cc b/src/xenia/kernel/xam/content_manager.cc index 7a6357a38..7e7026ae8 100644 --- a/src/xenia/kernel/xam/content_manager.cc +++ b/src/xenia/kernel/xam/content_manager.cc @@ -153,7 +153,7 @@ X_RESULT ContentManager::CreateContent(const std::string_view root_name, return X_ERROR_ALREADY_EXISTS; } - if (!xe::filesystem::CreateFolder(package_path)) { + if (!std::filesystem::create_directories(package_path)) { return X_ERROR_ACCESS_DENIED; } @@ -227,7 +227,7 @@ X_RESULT ContentManager::SetContentThumbnail(const XCONTENT_DATA& data, std::vector buffer) { auto global_lock = global_critical_region_.Acquire(); auto package_path = ResolvePackagePath(data); - xe::filesystem::CreateFolder(package_path); + std::filesystem::create_directories(package_path); if (std::filesystem::exists(package_path)) { auto thumb_path = package_path / kThumbnailFileName; auto file = xe::filesystem::OpenFile(thumb_path, "wb"); diff --git a/src/xenia/kernel/xam/user_profile.cc b/src/xenia/kernel/xam/user_profile.cc index 1fe8af1a8..eef76916e 100644 --- a/src/xenia/kernel/xam/user_profile.cc +++ b/src/xenia/kernel/xam/user_profile.cc @@ -158,7 +158,7 @@ void UserProfile::SaveSetting(UserProfile::Setting* setting) { auto serialized_setting = setting->Serialize(); auto content_dir = kernel_state()->content_manager()->ResolveGameUserContentPath(); - xe::filesystem::CreateFolder(content_dir); + std::filesystem::create_directories(content_dir); auto setting_id = fmt::format("{:08X}", setting->setting_id); auto file_path = content_dir / setting_id; auto file = xe::filesystem::OpenFile(file_path, "wb"); diff --git a/src/xenia/vfs/devices/host_path_device.cc b/src/xenia/vfs/devices/host_path_device.cc index ad77614c3..25cd568bb 100644 --- a/src/xenia/vfs/devices/host_path_device.cc +++ b/src/xenia/vfs/devices/host_path_device.cc @@ -29,7 +29,7 @@ bool HostPathDevice::Initialize() { if (!std::filesystem::exists(host_path_)) { if (!read_only_) { // Create the path. - xe::filesystem::CreateFolder(host_path_); + std::filesystem::create_directories(host_path_); } else { XELOGE("Host path does not exist"); return false; diff --git a/src/xenia/vfs/devices/host_path_entry.cc b/src/xenia/vfs/devices/host_path_entry.cc index b349bcbe0..069c2be5a 100644 --- a/src/xenia/vfs/devices/host_path_entry.cc +++ b/src/xenia/vfs/devices/host_path_entry.cc @@ -77,7 +77,7 @@ std::unique_ptr HostPathEntry::CreateEntryInternal( const std::string_view name, uint32_t attributes) { auto full_path = host_path_ / xe::to_path(name); if (attributes & kFileAttributeDirectory) { - if (!xe::filesystem::CreateFolder(full_path)) { + if (!std::filesystem::create_directories(full_path)) { return nullptr; } } else { diff --git a/src/xenia/vfs/vfs_dump.cc b/src/xenia/vfs/vfs_dump.cc index 282a8b0a7..98d8eb1b7 100644 --- a/src/xenia/vfs/vfs_dump.cc +++ b/src/xenia/vfs/vfs_dump.cc @@ -62,7 +62,7 @@ int vfs_dump_main(const std::vector& args) { XELOGI("{}", entry->path()); auto dest_name = base_path / xe::to_path(entry->path()); if (entry->attributes() & kFileAttributeDirectory) { - xe::filesystem::CreateFolder(dest_name); + std::filesystem::create_directories(dest_name); continue; }