| 9926 | } |
| 9927 | |
| 9928 | static void uninstall_vscode_profile_configs(const char *code_user, const char *binary_path, |
| 9929 | bool dry_run) { |
| 9930 | char profiles_dir[CLI_BUF_1K]; |
| 9931 | snprintf(profiles_dir, sizeof(profiles_dir), "%s/profiles", code_user); |
| 9932 | cbm_dir_t *directory = cbm_opendir(profiles_dir); |
| 9933 | if (!directory) { |
| 9934 | return; |
| 9935 | } |
| 9936 | cbm_dirent_t *entry; |
| 9937 | while ((entry = cbm_readdir(directory)) != NULL) { |
| 9938 | if (strcmp(entry->name, ".") == 0 || strcmp(entry->name, "..") == 0) { |
| 9939 | continue; |
| 9940 | } |
| 9941 | char profile_dir[CLI_BUF_1K]; |
| 9942 | snprintf(profile_dir, sizeof(profile_dir), "%s/%s", profiles_dir, entry->name); |
| 9943 | struct stat state; |
| 9944 | if (stat(profile_dir, &state) != 0 || !S_ISDIR(state.st_mode)) { |
| 9945 | continue; |
| 9946 | } |
| 9947 | char config_path[CLI_BUF_1K]; |
| 9948 | snprintf(config_path, sizeof(config_path), "%s/mcp.json", profile_dir); |
| 9949 | if (!dry_run && cbm_remove_vscode_mcp_owned(binary_path, config_path) != CLI_OK) { |
| 9950 | record_agent_config_error(true, "VS Code", "profile_mcp_uninstall", config_path); |
| 9951 | } |
| 9952 | } |
| 9953 | cbm_closedir(directory); |
| 9954 | } |
| 9955 | |
| 9956 | static bool cbm_filename_has_suffix(const char *name, const char *suffix) { |
| 9957 | size_t name_len = strlen(name); |
no test coverage detected