| 904 | } |
| 905 | |
| 906 | Result CreateResourcePartial(HFactory factory, HResourceType type, const char* name, void* data, uint32_t data_size, uint32_t file_size, void** resource) |
| 907 | { |
| 908 | assert(name); |
| 909 | assert(resource); |
| 910 | |
| 911 | DM_PROFILE(__FUNCTION__); |
| 912 | |
| 913 | dmMutex::ScopedLock lk(factory->m_LoadMutex); |
| 914 | |
| 915 | char canonical_path[RESOURCE_PATH_MAX]; |
| 916 | GetCanonicalPath(name, canonical_path, sizeof(canonical_path)); |
| 917 | dmhash_t canonical_path_hash = dmHashBuffer64(canonical_path, strlen(canonical_path)); |
| 918 | |
| 919 | Result res = CheckAndGetResourceFromPath(factory, canonical_path_hash, resource); |
| 920 | // If we found the resource, or if the result was anything other than "resource not exists", let's return |
| 921 | if (RESULT_OK == res || RESULT_RESOURCE_NOT_FOUND != res) |
| 922 | { |
| 923 | return res; |
| 924 | } |
| 925 | |
| 926 | ResourceType* resource_type = type; |
| 927 | if (resource_type == 0) |
| 928 | { |
| 929 | res = CheckAndGetResourceTypeFromPath(factory, canonical_path, &resource_type); |
| 930 | if (res != RESULT_OK) |
| 931 | { |
| 932 | return res; |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | return DoCreateResource(factory, resource_type, name, canonical_path, canonical_path_hash, data, data_size, file_size, resource); |
| 937 | } |
| 938 | |
| 939 | Result CreateResource(HFactory factory, const char* name, void* data, uint32_t data_size, void** resource) |
| 940 | { |
no test coverage detected