Inno Setup: How to overwrite on install but not on change? -
i know how overwrite files using method
[files] source: "project\*"; destdir: "{app}"; flags: ignoreversion recursesubdirs onlyifdoesntexist; permissions: everyone-full
but when change program using change option in 'install or change program' section want not overwrite files.
i create change option installer this:
[setup] appmodifypath="{srcexe}" /modify=1
how do this?
first, code seems wrong. onlyifdoesntexist
flag, files never overwritten, contrary claim.
anyway, solution create 2 [files]
entries, 1 overwrites , 1 not. , use pascal scripting pick entry respective installation mode.
[files] source: "project\*"; destdir: "{app}"; flags: ... onlyifdoesntexist; ...; check: isupgrade source: "project\*"; destdir: "{app}"; flags: ...; ...; check: not isupgrade
example of isupgrade
implementation:
[code] function isupgrade: boolean; var s: string; innosetupreg: string; apppathname: string; begin { expandconstant here inno script studio, } { generated appid in form of guid. } { leading { of guid has doubled in inno setup, } { , expandconstant collapses single {. } innosetupreg := expandconstant( 'software\microsoft\windows\currentversion\uninstall\{#setupsetting("appid")}_is1'); apppathname := 'inno setup: app path'; result := regquerystringvalue(hklm, innosetupreg, apppathname, s) or regquerystringvalue(hkcu, innosetupreg, apppathname, s); end;
Comments
Post a Comment