mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-18 22:50:25 +01:00
vfs: add exists test function
This commit is contained in:
parent
e6022c1c4c
commit
ceb0172b1e
|
|
@ -6,7 +6,6 @@
|
|||
#include "orbis/error/SysResult.hpp"
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
|
|
@ -183,6 +182,20 @@ orbis::SysResult rx::vfs::open(std::string_view path, int flags, int mode,
|
|||
return device->open(file, devPath.c_str(), flags, mode, thread);
|
||||
}
|
||||
|
||||
bool rx::vfs::exists(std::string_view path, orbis::Thread *thread) {
|
||||
auto [device, devPath] = get(path);
|
||||
if (device == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
orbis::Ref<orbis::File> file;
|
||||
if (device->open(&file, devPath.c_str(), 0, 0, thread) !=
|
||||
orbis::ErrorCode{}) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
orbis::SysResult rx::vfs::mkdir(std::string_view path, int mode,
|
||||
orbis::Thread *thread) {
|
||||
auto [device, devPath] = get(path);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ get(const std::filesystem::path &guestPath);
|
|||
orbis::SysResult mount(const std::filesystem::path &guestPath, IoDevice *dev);
|
||||
orbis::SysResult open(std::string_view path, int flags, int mode,
|
||||
orbis::Ref<orbis::File> *file, orbis::Thread *thread);
|
||||
bool exists(std::string_view path, orbis::Thread *thread);
|
||||
orbis::SysResult mkdir(std::string_view path, int mode, orbis::Thread *thread);
|
||||
orbis::SysResult rmdir(std::string_view path, orbis::Thread *thread);
|
||||
orbis::SysResult rename(std::string_view from, std::string_view to,
|
||||
|
|
|
|||
Loading…
Reference in a new issue