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

Function ReadFile

engine/resource/src/providers/provider_file.cpp:99–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98
99 static dmResourceProvider::Result ReadFile(dmResourceProvider::HArchiveInternal _archive, dmhash_t path_hash, const char* path, uint8_t* buffer, uint32_t buffer_len)
100 {
101 FileProviderContext* archive = (FileProviderContext*)_archive;
102 (void)path_hash;
103
104 char path_buffer[DMPATH_MAX_PATH];
105 const char* resolved_path = ResolveFilePath(&archive->m_BaseUri, path, path_buffer, sizeof(path_buffer));
106 if (!resolved_path) {
107 return dmResourceProvider::RESULT_NOT_FOUND;
108 }
109
110 uint32_t file_size;
111 dmSys::Result r = dmSys::LoadResource(resolved_path, buffer, buffer_len, &file_size);
112 return SysResultToProviderResult(r);
113 }
114
115 static dmResourceProvider::Result ReadFilePartial(dmResourceProvider::HArchiveInternal _archive, dmhash_t path_hash, const char* path, uint32_t offset, uint32_t size, uint8_t* buffer, uint32_t* nread)
116 {

Callers

nothing calls this directly

Calls 3

ResolveFilePathFunction · 0.85
LoadResourceFunction · 0.50

Tested by

no test coverage detected