Skip to content

Commit

Permalink
Windows silent uninstall fixes (qzind#714)
Browse files Browse the repository at this point in the history
Fix environmental variable detection for silent install/uninstall
Closes qzind#713
  • Loading branch information
tresf authored Sep 24, 2020
1 parent 52ecaba commit b5fb830
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ant/windows/windows-uninstaller.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ Section
; We're NOT running from $TEMP, copy to temp and respawn ourself
GetTempFileName $0
CopyFiles "$EXEPATH" "$0"
Exec '"$0" /RESPAWN=1 /DELETE_DIR="$EXEDIR" /DELETE_EXE="$EXEPATH"'
${If} ${Silent}
Exec '"$0" /S /RESPAWN=1 /DELETE_DIR="$EXEDIR" /DELETE_EXE="$EXEPATH"'
${Else}
Exec '"$0" /RESPAWN=1 /DELETE_DIR="$EXEDIR" /DELETE_EXE="$EXEPATH"'
${EndIf}
Quit
${EndIf}
SectionEnd
Expand Down
4 changes: 2 additions & 2 deletions src/qz/installer/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public abstract class Installer {
protected static final Logger log = LoggerFactory.getLogger(Installer.class);

// Silence prompts within our control
public static boolean IS_SILENT = "1".equals(System.getenv(PROPS_FILE + "_silent"));
public static boolean IS_SILENT = "1".equals(System.getenv(DATA_DIR + "_silent"));

public enum PrivilegeLevel {
USER,
Expand Down Expand Up @@ -75,7 +75,7 @@ public static Installer getInstance() {
}

public static void install(String destination, boolean silent) throws Exception {
IS_SILENT = silent;
IS_SILENT |= silent; // preserve environmental variable if possible
getInstance();
if (destination != null) {
instance.setDestination(destination);
Expand Down

0 comments on commit b5fb830

Please sign in to comment.