vfs: Correct file_p variable usage within InterpretAsDirectory()

ReplaceFileWithSubdirectory() takes a VirtualFile and a VirtualDir, but
it was being passed a string as one of its arguments. The only reason
this never caused issues is because this template isn't instantiated
anywhere yet.

This corrects an issue before it occurs.
merge-requests/60/head
Lioncash 2018-07-22 02:54:07 +07:00
parent 398444e676
commit 0081252d31
1 changed files with 5 additions and 2 deletions

@ -205,9 +205,12 @@ struct VfsDirectory : NonCopyable {
template <typename Directory>
bool InterpretAsDirectory(std::string_view file) {
auto file_p = GetFile(file);
if (file_p == nullptr)
if (file_p == nullptr) {
return false;
return ReplaceFileWithSubdirectory(file, std::make_shared<Directory>(file_p));
}
return ReplaceFileWithSubdirectory(file_p, std::make_shared<Directory>(file_p));
}
protected: