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

Function wide_stat

src/discover/discover.c:729–748  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

727
728/* UTF-8-safe stat: wide API on Windows, regular stat on POSIX. */
729static int wide_stat(const char *path, struct stat *st) {
730#ifdef _WIN32
731 wchar_t *wpath = cbm_path_to_wide(path);
732 if (!wpath) {
733 return CBM_NOT_FOUND;
734 }
735 struct _stat64 wst;
736 int ret = _wstat64(wpath, &wst);
737 free(wpath);
738 if (ret != 0) {
739 return CBM_NOT_FOUND;
740 }
741 st->st_mode = wst.st_mode;
742 st->st_size = wst.st_size;
743 st->st_mtime = wst.st_mtime;
744 return 0;
745#else
746 return stat(path, st);
747#endif
748}
749
750/* Stat a path, skipping symlinks (POSIX) and junctions / reparse points
751 * (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