(source: SettingSource)
| 243 | * @returns The root path of the settings file |
| 244 | */ |
| 245 | export function getSettingsRootPathForSource(source: SettingSource): string { |
| 246 | switch (source) { |
| 247 | case 'userSettings': { |
| 248 | const filePath = |
| 249 | getSettingsFilePathForSource(source) ?? |
| 250 | getSettingsWriteFilePathForSource(source) |
| 251 | return filePath |
| 252 | ? dirname(resolve(filePath)) |
| 253 | : resolve(getCanonicalNcodeConfigHomeDir()) |
| 254 | } |
| 255 | case 'policySettings': |
| 256 | case 'projectSettings': |
| 257 | case 'localSettings': { |
| 258 | return resolve(getOriginalCwd()) |
| 259 | } |
| 260 | case 'flagSettings': { |
| 261 | const path = getFlagSettingsPath() |
| 262 | return path ? dirname(resolve(path)) : resolve(getOriginalCwd()) |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Get the user settings filename based on cowork mode. |
no test coverage detected