winrt: fix error on uninstall
authorDavid Pinedo <david@lunarg.com>
Fri, 10 Jun 2016 17:37:44 +0000 (11:37 -0600)
committerDavid Pinedo <david@lunarg.com>
Fri, 10 Jun 2016 17:37:44 +0000 (11:37 -0600)
Remove old log files before writing them. When 2 uninstalls
are done in a row, this caused the uninstaller to display
an error

windowsRuntimeInstaller/InstallerRT.nsi

index 462cbb8..0bfd47f 100644 (file)
@@ -248,6 +248,7 @@ Function ${un}ConfigLayersAndVulkanDLL
     # Exectute the script by piping it to powershell.exe. This gets around possible OS
     # security restrictions on running powershell scripts.
     nsExec::ExecToStack 'cmd /k type "$TEMP\VulkanRT\VulkanRT.ps1" | powershell -NoProfile -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -Command -'
+    Delete "$TEMP\VulkanRT\ConfigLayersAndVulkanDLL1.${un}log"
     Rename "$TEMP\ConfigLayersAndVulkanDLL.log" "$TEMP\VulkanRT\ConfigLayersAndVulkanDLL1.${un}log"
     pop $0
 
@@ -255,6 +256,7 @@ Function ${un}ConfigLayersAndVulkanDLL
     ${If} $0 != 0
         nsExec::ExecToStack 'cmd /k type "$TEMP\VulkanRT\VulkanRT.ps1" | "$WINDIR\System32\WindowsPowerShell\v1.0\powershell" -NoProfile -NoLogo -NonInteractive -WindowStyle Hidden -inputformat none -Command -'
         pop $0
+        Delete "$TEMP\VulkanRT\ConfigLayersAndVulkanDLL2.${un}log"
         Rename "$TEMP\ConfigLayersAndVulkanDLL.log" "$TEMP\VulkanRT\ConfigLayersAndVulkanDLL2.${un}log"
     ${Endif}
 
@@ -274,6 +276,9 @@ Function ${un}ConfigLayersAndVulkanDLL
     Delete "$TEMP\ConfigLayersAndVulkanDLL.stat"
     Delete "$TEMP\VulkanRT\VulkanRT.ps1"
 
+    # Ignore errors. If something went wrong, the return value will indicate it.
+    ClearErrors
+
 FunctionEnd
 !macroend
 !insertmacro ConfigLayersAndVulkanDLL ""
@@ -294,6 +299,10 @@ Function ${un}DiagConfigLayersAndVulkanDLL
     nsExec::ExecToStack 'cmd /k dir "$WINDIR\System32\WindowsPowerShell\v1.0" >"$TEMP\VulkanRT\Diagnostic2.${un}log"'
     pop $1
     LogText "cmd2 rval is $1"
+    
+    # Ignore errors
+    ClearErrors
+
 FunctionEnd
 !macroend
 !insertmacro DiagConfigLayersAndVulkanDLL ""
@@ -506,7 +515,6 @@ Section
     ${If} $0 != 0
         SetOutPath "$INSTDIR"
         Call DiagConfigLayersAndVulkanDLL
-        ClearErrors
 
         # The Powershell script failed, and we don't know why.
         # Simply configure system to use our loader and vulkaninfo.