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

Function Dirname

engine/dlib/src/dlib/path.cpp:105–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 }
104
105 void Dirname(const char* path, char* out, uint32_t out_size)
106 {
107 char buf[DMPATH_MAX_PATH];
108 Normalize(path, buf, sizeof(buf));
109
110 if (strcmp(buf, ".") == 0)
111 {
112 // Special case
113 }
114 else
115 {
116 char* last_slash = strrchr(buf, '/');
117 if (last_slash)
118 {
119 if (last_slash != buf)
120 {
121 // Truncate string if slash found isn't
122 // the first character (edge case for path "/")
123 *last_slash = '\0';
124 }
125 }
126 else
127 {
128 buf[0] = '\0';
129 }
130 }
131 dmStrlCpy(out, buf, out_size);
132 }
133
134 void Concat(const char* path1, const char* path2, char* out, uint32_t out_size)
135 {

Callers 5

GetApplicationPathFunction · 0.85
GetResourcesPathFunction · 0.85
GetResourcesPathFunction · 0.85
TESTFunction · 0.85
engine.cppFile · 0.85

Calls 2

dmStrlCpyFunction · 0.85
NormalizeFunction · 0.70

Tested by 1

TESTFunction · 0.68