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

Function Normalize

engine/dlib/src/dlib/path.cpp:43–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 }
42
43 void Normalize(const char* path, char* out, uint32_t out_size)
44 {
45 assert(out_size > 0);
46
47 uint32_t i = 0;
48 while (*path && i < out_size)
49 {
50 int c = *path;
51 if (c == '/' || c == '\\')
52 {
53 out[i] = '/';
54 path = SkipSlashes(path);
55 }
56 else
57 {
58 out[i] = c;
59 ++path;
60 }
61
62 ++i;
63 }
64
65 if (i > 1 && out[i-1] == '/')
66 {
67 // Remove trailing /
68 out[i-1] = '\0';
69 }
70
71 out[dmMath::Min(i, out_size-1)] = '\0';
72 }
73
74 void NormalizeW(const wchar_t* path, wchar_t* out, uint32_t out_size)
75 {

Callers 9

MakeHostPathFunction · 0.70
MakeHostPathfFunction · 0.70
GetHostFileNameFunction · 0.70
DirnameFunction · 0.70
ConcatFunction · 0.70
TESTFunction · 0.50
MountFunction · 0.50
CameraScreenToWorldFunction · 0.50
CameraWorldToScreenFunction · 0.50

Calls 3

SkipSlashesFunction · 0.85
MinFunction · 0.85
assertFunction · 0.50

Tested by 3

MakeHostPathFunction · 0.56
MakeHostPathfFunction · 0.56
TESTFunction · 0.40