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

Function GetRawFile

engine/resource/src/test/test_provider_multi.cpp:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include <jc_test/jc_test.h>
32
33static uint8_t* GetRawFile(const char* path, uint32_t* size, bool override)
34{
35 const char* override_path = override ? "/overrides" : "";
36 const char* alternatives[2] = {
37 "build/src/test%s%s",
38 "src/test%s%s"
39 };
40 for (int i = 0; i < DM_ARRAY_SIZE(alternatives); ++i)
41 {
42 char path_buffer[256];
43 dmSnPrintf(path_buffer, sizeof(path_buffer), alternatives[i], override_path, path);
44
45 char host_buffer[256];
46 dmTestUtil::MakeHostPath(host_buffer, sizeof(host_buffer), path_buffer);
47 if (!dmSys::Exists(host_buffer))
48 continue;
49 return dmTestUtil::ReadHostFile(path_buffer, size);
50 }
51 return 0;
52}
53
54typedef dmResourceProvider::ArchiveLoader ArchiveLoader;
55

Callers 1

TEST_FFunction · 0.70

Calls 4

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

Tested by

no test coverage detected