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

Function GetCanonicalPathFromBase

engine/resource/src/resource_util.cpp:133–151  ·  view source on GitHub ↗

TODO: Test this...

Source from the content-addressed store, hash-verified

131
132// TODO: Test this...
133uint32_t GetCanonicalPathFromBase(const char* base_dir, const char* relative_dir, char* buf, uint32_t buf_len)
134{
135 dmSnPrintf(buf, buf_len, "%s/%s", base_dir, relative_dir);
136
137 char* source = buf;
138 char* dest = buf;
139 char last_c = 0;
140 while (*source != 0)
141 {
142 char c = *source;
143 if (c != '/' || (c == '/' && last_c != '/'))
144 *dest++ = c;
145
146 last_c = c;
147 ++source;
148 }
149 *dest = '\0';
150 return (uint32_t)(dest - buf);
151}
152
153uint32_t GetCanonicalPath(const char* relative_dir, char* buf, uint32_t buf_len)
154{

Callers 2

GetCanonicalPathFunction · 0.85
CreateEncodedUriFunction · 0.85

Calls 1

dmSnPrintfFunction · 0.85

Tested by

no test coverage detected