()
| 8 | import { extensionContext } from './extension'; |
| 9 | |
| 10 | export async function generateCppProperties(): Promise<void> { |
| 11 | const currentWorkspaceFolder = getCurrentWorkspaceFolder()?.uri.fsPath; |
| 12 | if (currentWorkspaceFolder === undefined) { |
| 13 | void window.showWarningMessage('Please open a workspace folder to create c_cpp_properties.json'); |
| 14 | return; |
| 15 | } |
| 16 | const outFilePath = path.join(currentWorkspaceFolder, '.vscode', 'c_cpp_properties.json'); |
| 17 | if (fs.existsSync(outFilePath)) { |
| 18 | const overwrite = await window.showWarningMessage( |
| 19 | '"c_cpp_properties.json" file already exists. Do you want to overwrite?', |
| 20 | 'Yes', 'No' |
| 21 | ); |
| 22 | if (overwrite === 'No') { |
| 23 | return; |
| 24 | } |
| 25 | void fs.unlinkSync(outFilePath); |
| 26 | } |
| 27 | return generateCppPropertiesProc(currentWorkspaceFolder); |
| 28 | } |
| 29 | |
| 30 | /** Helper: Return object depending on current process platform */ |
| 31 | function platformChoose<A, B, C>(win32: A, darwin: B, other: C): A | B | C { |
nothing calls this directly
no test coverage detected