Scan Code/User/profiles/ and install (or plan) a per-profile mcp.json for * each existing profile subdirectory, so VS Code profile users inherit the MCP * server without manual steps (#431). No-op when profiles/ is absent. */
| 8811 | * each existing profile subdirectory, so VS Code profile users inherit the MCP |
| 8812 | * server without manual steps (#431). No-op when profiles/ is absent. */ |
| 8813 | static void install_vscode_profile_configs(const char *code_user, const char *binary_path, |
| 8814 | bool dry_run) { |
| 8815 | char profiles_dir[CLI_BUF_1K]; |
| 8816 | snprintf(profiles_dir, sizeof(profiles_dir), "%s/profiles", code_user); |
| 8817 | cbm_dir_t *d = cbm_opendir(profiles_dir); |
| 8818 | if (!d) { |
| 8819 | return; |
| 8820 | } |
| 8821 | cbm_dirent_t *ent; |
| 8822 | while ((ent = cbm_readdir(d)) != NULL) { |
| 8823 | if (strcmp(ent->name, ".") == 0 || strcmp(ent->name, "..") == 0) { |
| 8824 | continue; |
| 8825 | } |
| 8826 | char profile_path[CLI_BUF_1K]; |
| 8827 | snprintf(profile_path, sizeof(profile_path), "%s/%s", profiles_dir, ent->name); |
| 8828 | struct stat st; |
| 8829 | if (stat(profile_path, &st) != 0 || !S_ISDIR(st.st_mode)) { |
| 8830 | continue; |
| 8831 | } |
| 8832 | char cp[CLI_BUF_1K]; |
| 8833 | snprintf(cp, sizeof(cp), "%s/mcp.json", profile_path); |
| 8834 | install_generic_agent_config("VS Code", binary_path, cp, NULL, dry_run, |
| 8835 | cbm_install_vscode_mcp); |
| 8836 | } |
| 8837 | cbm_closedir(d); |
| 8838 | } |
| 8839 | |
| 8840 | static void uninstall_vscode_profile_configs(const char *code_user, const char *binary_path, |
| 8841 | bool dry_run) { |
no test coverage detected