public ImportedExternalSDK GenerateBSPForSDK(ImportedSDKLocation location, ISDKImportHost host) { string temporaryDir = Path.Combine(host.GetDefaultDirectoryForImportedSDKs("arm-eabi"), Guid.NewGuid().ToString()); Directory.CreateDirectory(temporaryDir); try { host.ExtractZIPFile(location.OriginallySelectedFile, temporaryDir); var bsp = GenerateBSPForSTARTProject(temporaryDir, host.WarningSink); string newDir = Path.Combine(Path.GetDirectoryName(temporaryDir), bsp.PackageID); if (Directory.Exists(newDir)) { if (!host.AskWarn($"{newDir} already exists. Overwrite?")) { throw new OperationCanceledException(); } host.DeleteDirectoryRecursively(newDir); } Directory.Move(temporaryDir, newDir); return(new ImportedExternalSDK { BSPID = bsp.PackageID, Directory = newDir }); } catch { try { host.DeleteDirectoryRecursively(temporaryDir); } catch { } throw; } }