MCPcopy Create free account
hub / github.com/defold/defold / GetResourceSize

Function GetResourceSize

engine/resource/src/resource_mounts.cpp:294–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294dmResource::Result GetResourceSize(HContext ctx, dmhash_t path_hash, const char* path, uint32_t* resource_size)
295{
296 DM_MUTEX_SCOPED_LOCK(ctx->m_Mutex);
297
298 uint32_t size = ctx->m_Mounts.Size();
299 for (uint32_t i = 0; i < size; ++i)
300 {
301 ArchiveMount& mount = ctx->m_Mounts[i];
302 dmResourceProvider::Result result = dmResourceProvider::GetFileSize(mount.m_Archive, path_hash, path, resource_size);
303 if (dmResourceProvider::RESULT_NOT_FOUND == result)
304 continue;
305 if (dmResourceProvider::RESULT_OK == result)
306 {
307 DM_RESOURCE_DBG_LOG(3, "GetResourceSize OK: %s " DM_HASH_FMT " (%u bytes) - mount %s\n", path, path_hash, *resource_size, dmHashReverseSafe64(mount.m_NameHash));
308 DebugPrintMount(3, mount);
309 return dmResource::RESULT_OK;
310 }
311 return ProviderResultToResult(result);
312 }
313
314 if (!ctx->m_CustomFiles.Empty())
315 return GetCustomResourceSize(ctx, path_hash, path, resource_size);
316
317 return dmResource::RESULT_RESOURCE_NOT_FOUND;
318}
319
320dmResource::Result ResourceExists(HContext ctx, dmhash_t path_hash)
321{

Callers 1

ResourceExistsFunction · 0.70

Calls 7

dmHashReverseSafe64Function · 0.85
DebugPrintMountFunction · 0.85
ProviderResultToResultFunction · 0.85
GetCustomResourceSizeFunction · 0.85
GetFileSizeFunction · 0.50
SizeMethod · 0.45
EmptyMethod · 0.45

Tested by

no test coverage detected