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

Function cbm_canonicalize_drive

src/foundation/platform.c:69–74  ·  view source on GitHub ↗

Canonicalize a Windows drive letter to upper-case in place: "c:/x" -> "C:/x". * Windows drive letters are case-insensitive, but a lowercase one (as agent * CWDs often report, e.g. Claude Code's "c:\...") otherwise produces a distinct * project key ("c-..." vs "C-...") and, on a case-insensitive FS, a colliding * cache file that clobbers the good index (#227/#367/#394). Folding to a single * c

Source from the content-addressed store, hash-verified

67 * Only the strict drive-root form `X:/` or bare `X:` is touched, so ordinary
68 * POSIX paths (which never start that way) are unaffected. */
69static void cbm_canonicalize_drive(char *path) {
70 if (path && path[0] >= 'a' && path[0] <= 'z' && path[1] == ':' &&
71 (path[2] == '/' || path[2] == '\0')) {
72 path[0] = (char)(path[0] - 'a' + 'A');
73 }
74}
75
76#ifdef _WIN32
77

Callers 1

cbm_normalize_path_sepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected