diff --git a/src/xenia/kernel/fs/devices/host_path_device.cc b/src/xenia/kernel/fs/devices/host_path_device.cc index 03efc1b97..bec4fc39f 100644 --- a/src/xenia/kernel/fs/devices/host_path_device.cc +++ b/src/xenia/kernel/fs/devices/host_path_device.cc @@ -9,6 +9,7 @@ #include "xenia/kernel/fs/devices/host_path_device.h" +#include "poly/fs.h" #include "xenia/kernel/fs/devices/host_path_entry.h" #include "xenia/kernel/objects/xfile.h" @@ -33,8 +34,11 @@ std::unique_ptr HostPathDevice::ResolvePath(const char* path) { auto full_path = poly::join_paths(local_path_, rel_path); full_path = poly::fix_path_separators(full_path); + if (!poly::fs::PathExists(full_path)) { + return nullptr; + } + // TODO(benvanik): get file info - // TODO(benvanik): fail if does not exit // TODO(benvanik): switch based on type return std::make_unique(this, path, full_path); diff --git a/src/xenia/kernel/fs/devices/host_path_entry.cc b/src/xenia/kernel/fs/devices/host_path_entry.cc index 3eddc46cf..32a0de4d2 100644 --- a/src/xenia/kernel/fs/devices/host_path_entry.cc +++ b/src/xenia/kernel/fs/devices/host_path_entry.cc @@ -74,9 +74,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length, if (handle == INVALID_HANDLE_VALUE) { std::wstring target_path = local_path_; if (!file_name) { - target_path += L"*"; + target_path = poly::join_paths(target_path, L"*"); } else { - target_path += poly::to_wstring(file_name); + target_path = poly::join_paths(target_path, poly::to_wstring(file_name)); } handle = find_file_ = FindFirstFile(target_path.c_str(), &ffd); if (handle == INVALID_HANDLE_VALUE) { diff --git a/src/xenia/kernel/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl_io.cc index bda5e37f4..fa8d30fee 100644 --- a/src/xenia/kernel/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl_io.cc @@ -117,9 +117,9 @@ X_STATUS NtCreateFile(PPCContext* ppc_state, KernelState* state, } else { // Open the file/directory. result = fs->Open(std::move(entry), state, - desired_access == FileAccess::X_GENERIC_READ - ? fs::Mode::READ - : fs::Mode::READ_WRITE, + desired_access & FileAccess::X_GENERIC_WRITE + ? fs::Mode::READ_WRITE + : fs::Mode::READ, false, // TODO(benvanik): pick async mode, if needed. &file); }