MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / _appendPath

Function _appendPath

modules/io/files/littlefs/files-littlefs.c:160–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158#define appendPath(dirPath, slot) _appendPath(the, dirPath, &slot)
159
160static char *_appendPath(xsMachine *the, char *dirPath, xsSlot *slot)
161{
162 size_t dirLen = c_strlen(dirPath);
163 char *path = _getPath(the, slot);
164 char *result = fxNewChunk(the, dirLen + c_strlen(path) + 1);
165 path = xsmcToString(*slot); // refresh
166 c_strcpy(result, dirPath);
167 c_strcat(result, path);
168 size_t resultLen = c_strlen(result);
169 if ('/' == result[resultLen - 1])
170 result[resultLen - 1] = 0; // remove trailing slash
171 return result;
172}
173
174
175/*

Callers

nothing calls this directly

Calls 2

fxNewChunkFunction · 0.85
_getPathFunction · 0.70

Tested by

no test coverage detected