Skip to content

Commit e589241

Browse files
committed
use IFile pointer instead of file path
1 parent 85e0dad commit e589241

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

68_JpegLoading/main.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,18 @@ class JpegLoaderApp final : public application_templates::MonoAssetManagerAndBui
134134
if (path.has_extension() && path.extension() == ".jpg")
135135
{
136136
files.emplace_back(std::move(path.generic_string()));
137-
tp.enqueue([=] {
138-
m_logger->log("Loading %S", ILogger::ELL_INFO, path.c_str());
139-
m_assetMgr->getAsset(path.generic_string(), loadParams);
140-
});
137+
138+
ISystem::future_t<smart_refctd_ptr<system::IFile>> future;
139+
m_system->createFile(future, path, IFile::ECF_READ);
140+
141+
if (auto pFile = future.acquire(); pFile && pFile->get())
142+
{
143+
auto& file = *pFile;
144+
tp.enqueue([=] {
145+
m_logger->log("Loading %S", ILogger::ELL_INFO, path.c_str());
146+
m_assetMgr->getAsset(file.get(), path.generic_string(), loadParams);
147+
});
148+
}
141149
}
142150
}
143151
}

0 commit comments

Comments
 (0)