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

Function cbm_json_mcp_paths_equal

src/cli/cli.c:1876–1897  ·  view source on GitHub ↗

Path-shape-insensitive equality for OUR OWN binary path (#1582): clients * and installers spell the same Windows file with different separators (the * entry stores `C:\...\cbm.exe`, the installer compares `C:/.../cbm.exe`), * and Windows filesystems are case-insensitive. Separators always compare * equal; case only folds on Windows. POSIX byte-exactness otherwise holds. */

Source from the content-addressed store, hash-verified

1874 * and Windows filesystems are case-insensitive. Separators always compare
1875 * equal; case only folds on Windows. POSIX byte-exactness otherwise holds. */
1876static bool cbm_json_mcp_paths_equal(const char *a, const char *b) {
1877 while (*a && *b) {
1878 char ca = *a;
1879 char cb = *b;
1880 if (ca == '\\') {
1881 ca = '/';
1882 }
1883 if (cb == '\\') {
1884 cb = '/';
1885 }
1886#ifdef _WIN32
1887 ca = (char)tolower((unsigned char)ca);
1888 cb = (char)tolower((unsigned char)cb);
1889#endif
1890 if (ca != cb) {
1891 return false;
1892 }
1893 a++;
1894 b++;
1895 }
1896 return *a == *b;
1897}
1898
1899static bool cbm_json_mcp_owned_command(const char *command, const char *expected_binary,
1900 const char *previous_managed_binary) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected