Merge pull request #251 from DrChat/fs_qualified_check

FS ResolvePath fix for fully qualified paths
This commit is contained in:
Ben Vanik 2015-06-10 17:21:53 -07:00
commit 6be12a61c1
1 changed files with 13 additions and 3 deletions

View File

@ -76,15 +76,15 @@ int FileSystem::InitializeFromPath(fs::FileSystemType type,
// Register the local directory in the virtual filesystem.
int result_code = RegisterHostPathDevice(
"\\Device\\Harddisk1\\Partition0", parent_path, true);
"\\Device\\Harddisk0\\Partition0", parent_path, true);
if (result_code) {
XELOGE("Unable to mount local directory");
return result_code;
}
// Create symlinks to the device.
CreateSymbolicLink("game:", "\\Device\\Harddisk1\\Partition0");
CreateSymbolicLink("d:", "\\Device\\Harddisk1\\Partition0");
CreateSymbolicLink("game:", "\\Device\\Harddisk0\\Partition0");
CreateSymbolicLink("d:", "\\Device\\Harddisk0\\Partition0");
break;
}
case FileSystemType::DISC_IMAGE: {
@ -165,6 +165,16 @@ std::unique_ptr<Entry> FileSystem::ResolvePath(const std::string& path) {
}
}
// Not to fret, check to see if the path is fully qualified.
if (device_path.empty()) {
for (auto& device : devices_) {
if (xe::find_first_of_case(normalized_path, device->path()) == 0) {
device_path = device->path();
relative_path = normalized_path.substr(device_path.size());
}
}
}
if (device_path.empty()) {
XELOGE("ResolvePath(%s) failed - no root found", path.c_str());
return nullptr;