(flutterCapabilities: FlutterCapabilities, sampleID: string, flutterSdkOverride?: string)
| 8 | import { writeFlutterSdkSettingIntoProject, writeFlutterTriggerFile } from "../utils/projects"; |
| 9 | |
| 10 | export function createFlutterSampleInTempFolder(flutterCapabilities: FlutterCapabilities, sampleID: string, flutterSdkOverride?: string): vs.Uri | undefined { |
| 11 | // Create a temp folder for the sample. |
| 12 | const tempSamplePath = path.join(os.tmpdir(), dartCodeExtensionIdentifier, "flutter", "sample", sampleID, getRandomInt(0x1000, 0x10000).toString(16)); |
| 13 | |
| 14 | // Create the empty folder so we can open it. |
| 15 | mkDirRecursive(tempSamplePath); |
| 16 | |
| 17 | const triggerData: FlutterCreateTriggerData = { sample: sampleID }; |
| 18 | writeFlutterTriggerFile(tempSamplePath, triggerData); |
| 19 | |
| 20 | // If we're using a custom SDK, we need to apply it to the new project too. |
| 21 | if (flutterSdkOverride) |
| 22 | writeFlutterSdkSettingIntoProject(flutterSdkOverride, tempSamplePath); |
| 23 | |
| 24 | const folderUri = vs.Uri.file(tempSamplePath); |
| 25 | void vs.commands.executeCommand("vscode.openFolder", folderUri); |
| 26 | |
| 27 | return folderUri; |
| 28 | } |
no test coverage detected