diff --git a/Setup/Program.cs b/Setup/Program.cs index 5058145..27d072b 100644 --- a/Setup/Program.cs +++ b/Setup/Program.cs @@ -1,5 +1,7 @@ using System; +using System.IO; using WixSharp; +using File = WixSharp.File; namespace Setup { @@ -10,7 +12,7 @@ public static void Main() var exe = new File(@"..\APKInstaller\bin\Release\APKInstaller.exe"); exe.Shortcuts = new[] { new FileShortcut("APK Installer", "%ProgramMenu%") }; var files = new Dir(@"%ProgramFiles%\yutokun\APK Installer", exe); - var project = new Project("APK Installer", files) + var project = new ManagedProject("APK Installer", files) { ProductId = new Guid("f9b8f955-f62f-4765-a2e3-c94c198b3eb0"), UpgradeCode = new Guid("f9b8f955-f62f-4765-a2e3-c94c198b3eb1"), @@ -18,7 +20,17 @@ public static void Main() LicenceFile = "../LICENSE.rtf", Language = "ja-JP" }; + project.AfterInstall += RemoveTempFolder; Compiler.BuildMsi(project); } + + static void RemoveTempFolder(SetupEventArgs e) + { + if (e.IsUninstalling) + { + var temp = Path.Combine(Path.GetTempPath(), "APKInstaller"); + Directory.Delete(temp, true); + } + } } }