MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / join_and_strip

Function join_and_strip

src/pipeline/pass_pkgmap.c:167–182  ·  view source on GitHub ↗

Join directory + relative entry path, normalize. * "packages/foo" + "src/index.ts" → "packages/foo/src/index" (stripped ext) */

Source from the content-addressed store, hash-verified

165/* Join directory + relative entry path, normalize.
166 * "packages/foo" + "src/index.ts""packages/foo/src/index" (stripped ext) */
167static char *join_and_strip(const char *dir, const char *entry) {
168 if (!entry || entry[0] == '\0') {
169 return NULL;
170 }
171 /* Skip leading ./ from entry */
172 if (entry[0] == '.' && entry[SKIP_ONE] == '/') {
173 entry += PAIR_LEN;
174 }
175 char buf[PKGMAP_PATH_BUF];
176 if (dir[0] == '\0') {
177 snprintf(buf, sizeof(buf), "%s", entry);
178 } else {
179 snprintf(buf, sizeof(buf), "%s/%s", dir, entry);
180 }
181 return strip_extension(buf);
182}
183
184/* Check if a string ends with a suffix. */
185static bool ends_with(const char *s, const char *suffix) {

Callers 1

parse_package_jsonFunction · 0.85

Calls 1

strip_extensionFunction · 0.85

Tested by

no test coverage detected