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

Function wide_stat

src/discover/discover.c:733–752  ·  view source on GitHub ↗

UTF-8-safe stat: wide API on Windows, regular stat on POSIX. */

Source from the content-addressed store, hash-verified

731
732/* UTF-8-safe stat: wide API on Windows, regular stat on POSIX. */
733static int wide_stat(const char *path, struct stat *st) {
734#ifdef _WIN32
735 wchar_t *wpath = cbm_path_to_wide(path);
736 if (!wpath) {
737 return CBM_NOT_FOUND;
738 }
739 struct _stat64 wst;
740 int ret = _wstat64(wpath, &wst);
741 free(wpath);
742 if (ret != 0) {
743 return CBM_NOT_FOUND;
744 }
745 st->st_mode = wst.st_mode;
746 st->st_size = wst.st_size;
747 st->st_mtime = wst.st_mtime;
748 return 0;
749#else
750 return stat(path, st);
751#endif
752}
753
754/* Stat a path, skipping symlinks (POSIX) and junctions / reparse points
755 * (Windows). Returns 0 on success, -1 to skip. Skipping reparse points keeps

Callers 4

safe_statFunction · 0.85
resolve_git_common_dirFunction · 0.85
discover_implFunction · 0.85

Calls 2

cbm_path_to_wideFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected