Fixing path issues for host FS.
This commit is contained in:
parent
f8c7c97d54
commit
ea5175cab5
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "xenia/kernel/fs/devices/host_path_device.h"
|
#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/fs/devices/host_path_entry.h"
|
||||||
#include "xenia/kernel/objects/xfile.h"
|
#include "xenia/kernel/objects/xfile.h"
|
||||||
|
|
||||||
|
@ -33,8 +34,11 @@ std::unique_ptr<Entry> HostPathDevice::ResolvePath(const char* path) {
|
||||||
auto full_path = poly::join_paths(local_path_, rel_path);
|
auto full_path = poly::join_paths(local_path_, rel_path);
|
||||||
full_path = poly::fix_path_separators(full_path);
|
full_path = poly::fix_path_separators(full_path);
|
||||||
|
|
||||||
|
if (!poly::fs::PathExists(full_path)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(benvanik): get file info
|
// TODO(benvanik): get file info
|
||||||
// TODO(benvanik): fail if does not exit
|
|
||||||
// TODO(benvanik): switch based on type
|
// TODO(benvanik): switch based on type
|
||||||
|
|
||||||
return std::make_unique<HostPathEntry>(this, path, full_path);
|
return std::make_unique<HostPathEntry>(this, path, full_path);
|
||||||
|
|
|
@ -74,9 +74,9 @@ X_STATUS HostPathEntry::QueryDirectory(XDirectoryInfo* out_info, size_t length,
|
||||||
if (handle == INVALID_HANDLE_VALUE) {
|
if (handle == INVALID_HANDLE_VALUE) {
|
||||||
std::wstring target_path = local_path_;
|
std::wstring target_path = local_path_;
|
||||||
if (!file_name) {
|
if (!file_name) {
|
||||||
target_path += L"*";
|
target_path = poly::join_paths(target_path, L"*");
|
||||||
} else {
|
} 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);
|
handle = find_file_ = FindFirstFile(target_path.c_str(), &ffd);
|
||||||
if (handle == INVALID_HANDLE_VALUE) {
|
if (handle == INVALID_HANDLE_VALUE) {
|
||||||
|
|
|
@ -117,9 +117,9 @@ X_STATUS NtCreateFile(PPCContext* ppc_state, KernelState* state,
|
||||||
} else {
|
} else {
|
||||||
// Open the file/directory.
|
// Open the file/directory.
|
||||||
result = fs->Open(std::move(entry), state,
|
result = fs->Open(std::move(entry), state,
|
||||||
desired_access == FileAccess::X_GENERIC_READ
|
desired_access & FileAccess::X_GENERIC_WRITE
|
||||||
? fs::Mode::READ
|
? fs::Mode::READ_WRITE
|
||||||
: fs::Mode::READ_WRITE,
|
: fs::Mode::READ,
|
||||||
false, // TODO(benvanik): pick async mode, if needed.
|
false, // TODO(benvanik): pick async mode, if needed.
|
||||||
&file);
|
&file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue