Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Fix userconfig test on Windows: use APPDATA instead of XDG_CONFIG_HOME
Martin Vogel07f78e893329
diff --git a/tests/test_userconfig.c b/tests/test_userconfig.cindex bc4f8fd45..9e0c6f04f 100644--- a/tests/test_userconfig.c+++ b/tests/test_userconfig.c@@ -56,12 +56,13 @@ TEST(userconfig_project_basic) {/* ── Tests: global config ────────────────────────────────────────── */TEST(userconfig_global_via_env) {- /* Point XDG_CONFIG_HOME to a temp dir */- char xdg_dir[256];- snprintf(xdg_dir, sizeof(xdg_dir), "%s/uctest_global_xdg", cbm_tmpdir());+ /* Point config dir to a temp dir via the platform-appropriate env var:+ * XDG_CONFIG_HOME on Linux/macOS, APPDATA on Windows. */+ char cfg_dir[256];+ snprintf(cfg_dir, sizeof(cfg_dir), "%s/uctest_global_xdg", cbm_tmpdir());char app_dir[512];- snprintf(app_dir, sizeof(app_dir), "%s/codebase-memory-mcp", xdg_dir);+ snprintf(app_dir, sizeof(app_dir), "%s/codebase-memory-mcp", cfg_dir);cbm_mkdir_p(app_dir, 0755);char global_path[768];@@ -70,10 +71,23 @@ TEST(userconfig_global_via_env) {write_json(global_path, "{\"extra_extensions\":{\".twig\":\"html\"}}"),0);- /* Set env var, load, restore */- cbm_setenv("XDG_CONFIG_HOME", xdg_dir, 1);+#ifdef _WIN32+ char old_appdata[512] = "";+ cbm_safe_getenv("APPDATA", old_appdata, sizeof(old_appdata), NULL);+ cbm_setenv("APPDATA", cfg_dir, 1);+#else+ cbm_setenv("XDG_CONFIG_HOME", cfg_dir, 1);+#endifcbm_userconfig_t *cfg = cbm_userconfig_load(NULL); /* no project dir */+#ifdef _WIN32+ if (old_appdata[0]) {+ cbm_setenv("APPDATA", old_appdata, 1);+ } else {+ cbm_unsetenv("APPDATA");+ }+#elsecbm_unsetenv("XDG_CONFIG_HOME");+#endifASSERT_NOT_NULL(cfg);ASSERT_EQ(cbm_userconfig_lookup(cfg, ".twig"), CBM_LANG_HTML);