Core/AppFilesystemComponent: Fix Open with physical files
This commit is contained in:
parent
3cf50221c5
commit
c7b1c8b155
|
|
@ -162,7 +162,13 @@ namespace Nz
|
|||
}
|
||||
else if constexpr (std::is_same_v<Param, VirtualDirectory::FileEntry>)
|
||||
{
|
||||
resource = T::OpenFromStream(*arg.stream, params, std::forward<ExtraArgs>(args)...);
|
||||
// If stream has an associated filesystem path, use OpenFromFile instead to make sure the File stream is kept alive
|
||||
// (a temporary FileEntry may be created when resolving a filesystem folder)
|
||||
if (std::filesystem::path filePath = arg.stream->GetPath(); !filePath.empty())
|
||||
resource = T::OpenFromFile(*arg.stream, params, std::forward<ExtraArgs>(args)...);
|
||||
else
|
||||
resource = T::OpenFromStream(*arg.stream, params, std::forward<ExtraArgs>(args)...);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue