filesystem: use std for IsFolder
Remove custom platform implementation of IsFolder and replace single use with `std::filesystem::is_directory`.
This commit is contained in:
parent
05a62673f7
commit
a9fa38c88b
|
@ -52,9 +52,6 @@ bool CreateFolder(const std::filesystem::path& path);
|
|||
// Returns true if the path was found and removed.
|
||||
bool DeleteFolder(const std::filesystem::path& path);
|
||||
|
||||
// Returns true if the given path exists and is a folder.
|
||||
bool IsFolder(const std::filesystem::path& path);
|
||||
|
||||
// Creates an empty file at the given path.
|
||||
bool CreateFile(const std::filesystem::path& path);
|
||||
|
||||
|
|
|
@ -137,14 +137,6 @@ static uint64_t convertUnixtimeToWinFiletime(time_t unixtime) {
|
|||
return filetime;
|
||||
}
|
||||
|
||||
bool IsFolder(const std::filesystem::path& path) {
|
||||
struct stat st;
|
||||
if (stat(path.c_str(), &st) == 0) {
|
||||
if (S_ISDIR(st.st_mode)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CreateFile(const std::filesystem::path& path) {
|
||||
int file = creat(path.c_str(), 0774);
|
||||
if (file >= 0) {
|
||||
|
|
|
@ -84,12 +84,6 @@ bool DeleteFolder(const std::filesystem::path& path) {
|
|||
return SHFileOperation(&op) == 0;
|
||||
}
|
||||
|
||||
bool IsFolder(const std::filesystem::path& path) {
|
||||
DWORD attrib = GetFileAttributes(path.c_str());
|
||||
return attrib != INVALID_FILE_ATTRIBUTES &&
|
||||
(attrib & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY;
|
||||
}
|
||||
|
||||
bool CreateFile(const std::filesystem::path& path) {
|
||||
auto handle = CreateFileW(path.c_str(), 0, 0, nullptr, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
|
|
|
@ -61,7 +61,7 @@ StfsContainerDevice::~StfsContainerDevice() = default;
|
|||
|
||||
bool StfsContainerDevice::Initialize() {
|
||||
// Resolve a valid STFS file if a directory is given.
|
||||
if (filesystem::IsFolder(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;
|
||||
|
|
Loading…
Reference in New Issue