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

Function GetRawFile

engine/resource/src/test/test_provider_zip.cpp:80–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80static uint8_t* GetRawFile(const char* path, uint32_t* size, bool override)
81{
82 const char* override_path = override ? "/zipfiles" : "";
83 const char* alternatives[2] = {
84 "build/src/test%s%s",
85 "src/test%s%s"
86 };
87 for (int i = 0; i < DM_ARRAY_SIZE(alternatives); ++i)
88 {
89 char path_buffer[256];
90 dmSnPrintf(path_buffer, sizeof(path_buffer), alternatives[i], override_path, path);
91
92 char host_buffer[256];
93 dmTestUtil::MakeHostPath(host_buffer, sizeof(host_buffer), path_buffer);
94 if (!dmSys::Exists(host_buffer))
95 continue;
96 return dmTestUtil::ReadHostFile(path_buffer, size);
97 }
98 return 0;
99}
100
101// ****************************************************************************************************************
102

Callers 1

TEST_PFunction · 0.70

Calls 4

dmSnPrintfFunction · 0.85
MakeHostPathFunction · 0.85
ReadHostFileFunction · 0.85
ExistsFunction · 0.50

Tested by

no test coverage detected