Skip to content

Commit

Permalink
vfs: allow cross fs operations if both are host fw
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 20, 2024
1 parent 87c0cd7 commit c2f317b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rpcsx/vfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,21 @@ orbis::ErrorCode vfs::createSymlink(std::string_view target,
}

if (fromDevice != targetDevice) {
std::fprintf(stderr, "cross fs operation: %s -> %s\n",
std::string(target).c_str(), std::string(linkPath).c_str());
std::abort();
auto fromHost = fromDevice.cast<HostFsDevice>();
auto targetHost = targetDevice.cast<HostFsDevice>();

if (fromHost == nullptr || targetHost == nullptr) {
std::fprintf(stderr, "cross fs operation: %s -> %s\n",
std::string(target).c_str(), std::string(linkPath).c_str());
std::abort();
}

std::error_code ec;
std::filesystem::create_symlink(
std::filesystem::absolute(fromHost->hostPath + "/" +
fromDevPath.c_str()),
targetHost->hostPath + "/" + toDevPath.c_str(), ec);
return convertErrorCode(ec);
}

return fromDevice->createSymlink(fromDevPath.c_str(), toDevPath.c_str(),
Expand Down

0 comments on commit c2f317b

Please sign in to comment.