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:188–201  ·  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

186 * only at the Win32 file-API boundary, so remove it before widening callers
187 * compose adjacent runtime-asset paths. */
188static inline void cbm_module_path_unprefix(wchar_t *wide) {
189 if (!wide) {
190 return;
191 }
192 if (_wcsnicmp(wide, L"\\\\?\\UNC\\", 8U) == 0) {
193 size_t tail_length = wcslen(wide + 8U);
194 wmemmove(wide + 2U, wide + 8U, tail_length + 1U);
195 wide[0] = L'\\';
196 wide[1] = L'\\';
197 } else if (wcsncmp(wide, L"\\\\?\\", 4U) == 0) {
198 size_t tail_length = wcslen(wide + 4U);
199 wmemmove(wide, wide + 4U, tail_length + 1U);
200 }
201}
202
203static inline char *cbm_wide_to_utf8(const wchar_t *wide) {
204 if (!wide) {

Callers 1

cbm_module_path_utf8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected