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

Function _appendPath

modules/io/files/zephyr/files-zephyr.c:87–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85#define appendPath(dirPath, slot) _appendPath(the, dirPath, &slot)
86
87static char *_appendPath(xsMachine *the, char *dirPath, xsSlot *slot)
88{
89 size_t dirLen = c_strlen(dirPath);
90 char *path = _getPath(the, slot);
91 char *result = fxNewChunk(the, dirLen + 1 + c_strlen(path) + 1);
92 path = xsmcToString(*slot); // refresh
93 c_strcpy(result, dirPath);
94 c_strcat(result, "/");
95 c_strcat(result, path);
96 size_t resultLen = c_strlen(result);
97 if ('/' == result[resultLen - 1])
98 result[resultLen - 1] = 0; // remove trailing slash
99 return result;
100}
101
102/*
103 File

Callers

nothing calls this directly

Calls 2

fxNewChunkFunction · 0.85
_getPathFunction · 0.70

Tested by

no test coverage detected