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

Function cbm_module_path_unprefix

src/foundation/win_utf8.h:131–144  ·  view source on GitHub ↗

GetModuleFileNameW can preserve the \\?\ spelling used to launch a process. * Internal UTF-8 paths use conventional DOS/UNC spelling and add the prefix * only at the Win32 file-API boundary, so remove it before widening callers * compose adjacent runtime-asset paths. */

Source from the content-addressed store, hash-verified

129 * only at the Win32 file-API boundary, so remove it before widening callers
130 * compose adjacent runtime-asset paths. */
131static inline void cbm_module_path_unprefix(wchar_t *wide) {
132 if (!wide) {
133 return;
134 }
135 if (_wcsnicmp(wide, L"\\\\?\\UNC\\", 8U) == 0) {
136 size_t tail_length = wcslen(wide + 8U);
137 wmemmove(wide + 2U, wide + 8U, tail_length + 1U);
138 wide[0] = L'\\';
139 wide[1] = L'\\';
140 } else if (wcsncmp(wide, L"\\\\?\\", 4U) == 0) {
141 size_t tail_length = wcslen(wide + 4U);
142 wmemmove(wide, wide + 4U, tail_length + 1U);
143 }
144}
145
146static inline char *cbm_wide_to_utf8(const wchar_t *wide) {
147 if (!wide) {

Callers 1

cbm_module_path_utf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected