Fixing path issues for host FS.

This commit is contained in:
Ben Vanik 2015-02-12 21:52:46 -08:00
parent f8c7c97d54
commit ea5175cab5
3 changed files with 10 additions and 6 deletions

View File

@ -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<Entry> 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<HostPathEntry>(this, path, full_path);

View File

@ -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) {

View File

@ -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);
}