Skip to content

Commit

Permalink
fix(extra-natives/five): LOAD_WATER_FROM_PATH was not combining path …
Browse files Browse the repository at this point in the history
…properly
  • Loading branch information
ranstar74 authored and blattersturm committed May 11, 2023
1 parent 7e9d278 commit 750bf21
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion code/components/extra-natives-five/src/WaterExtraNatives.cpp
Expand Up @@ -677,11 +677,20 @@ static HookFunction initFunction([]()
return;
}

auto filePath = resource->GetPath() + "/" + context.GetArgument<const char*>(1);
std::string filePath = resource->GetPath();

// Make sure path separator exists or add it before combining path with file name
char c = filePath[filePath.length() - 1];
if (c != '/' && c != '\\')
filePath += '/';

filePath += context.GetArgument<const char*>(1);

fwRefContainer<vfs::Stream> stream = vfs::OpenRead(filePath);

if (!stream.GetRef())
{
trace("unable to find water file at %s\n", filePath.c_str());
context.SetResult(false);
return;
}
Expand Down

0 comments on commit 750bf21

Please sign in to comment.