Returns the VS Code user data directory, platform-specific.
(home: &Path)
| 1158 | |
| 1159 | /// Returns the VS Code user data directory, platform-specific. |
| 1160 | pub fn vscode_data_dir(home: &Path) -> PathBuf { |
| 1161 | #[cfg(target_os = "macos")] |
| 1162 | { |
| 1163 | home.join("Library/Application Support/Code") |
| 1164 | } |
| 1165 | #[cfg(target_os = "linux")] |
| 1166 | { |
| 1167 | home.join(".config/Code") |
| 1168 | } |
| 1169 | #[cfg(target_os = "windows")] |
| 1170 | { |
| 1171 | if let Ok(appdata) = std::env::var("APPDATA") { |
| 1172 | let appdata_path = PathBuf::from(&appdata); |
| 1173 | if appdata_path.starts_with(home) { |
| 1174 | return appdata_path.join("Code"); |
| 1175 | } |
| 1176 | } |
| 1177 | home.join("AppData/Roaming/Code") |
| 1178 | } |
| 1179 | #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] |
| 1180 | { |
| 1181 | home.join(".config/Code") |
| 1182 | } |
| 1183 | } |
| 1184 | |
| 1185 | /// Returns the platform-specific VS Code Insiders data directory. |
| 1186 | pub fn vscode_insiders_data_dir(home: &Path) -> PathBuf { |
no outgoing calls