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

Function CheckAndGetResourceTypeFromPath

engine/resource/src/resource.cpp:830–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830static Result CheckAndGetResourceTypeFromPath(HFactory factory, const char* canonical_path, HResourceType* resource_type_out)
831{
832 const char* ext = GetExtFromPath(canonical_path);
833
834 if (!ext)
835 {
836 dmLogWarning("Unable to load resource: '%s'. Missing file extension.", canonical_path);
837 return RESULT_MISSING_FILE_EXTENSION;
838 }
839
840 ResourceType* resource_type = FindResourceType(factory, ext);
841 if (resource_type == 0)
842 {
843 dmLogError("Unknown resource type: %s", ext);
844 return RESULT_UNKNOWN_RESOURCE_TYPE;
845 }
846
847 *resource_type_out = resource_type;
848
849 return RESULT_OK;
850}
851
852// Assumes m_LoadMutex is already held
853static Result CheckAndGetResourceAndType(HFactory factory, const char* canonical_path, dmhash_t canonical_path_hash, void** resource_out, HResourceType* resource_type_out)

Callers 2

CreateResourcePartialFunction · 0.85

Calls 2

GetExtFromPathFunction · 0.85
FindResourceTypeFunction · 0.85

Tested by

no test coverage detected