Syscalls: Avoid unnecessary string copies and clean up error handling

This commit is contained in:
Tony Wasserka committed 2023-01-26 11:20:29 +01:00
1 parent 420c4ca08f
commit 94ef3729bf
1 file changed
+3 -7
+3 -7
View File
@@ -189,7 +189,7 @@ static bool IsShebangFile(std::span<char> Data) {
if (Argument.empty()) {
continue;
}
ShebangArguments.emplace_back(Argument);
ShebangArguments.push_back(std::move(Argument));
}
// Executable argument
@@ -198,16 +198,12 @@ static bool IsShebangFile(std::span<char> Data) {
// If the filename is absolute then prepend the rootfs
// If it is relative then don't append the rootfs
if (ShebangProgram[0] == '/') {
std::string RootFS = FEX::HLE::_SyscallHandler->RootFSPath();
ShebangProgram = RootFS + ShebangProgram;
ShebangProgram = FEX::HLE::_SyscallHandler->RootFSPath() + ShebangProgram;
}
std::error_code ec;
bool exists = std::filesystem::exists(ShebangProgram, ec);
if (ec || !exists) {
return false;
}
return true;
return !ec && exists;
}
return false;