3

I need ignore some files (".sdf" and ".config") only when I'm doing a update on a installed application.

I'm getting the files recursively:

[Files]
Source: "..\..\bin\Release\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Release\*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full; Excludes: "*.key, *.udb, *.~db, *.crt"

Exist some way?

Thanks in advance.

Answer 1

Using onlyifdestfileexists and onlyifdoesntexist:

If the files don't exist (onlyifdoesntexist), copy all you want on first installation.

If the files exist (onlyifdestfileexists), add in Excludes those extensions that you don't want to update.

Source: "..\..\bin\Release\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist recursesubdirs createallsubdirs; Permissions: everyone-full; Excludes: "*.key, *.udb, *.~db, *.crt"
Source: "..\..\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion onlyifdestfileexists recursesubdirs createallsubdirs; Excludes: "*.key, *.udb, *.~db, *.crt, *.sdf, *.config"

Answer 2 (It was not fully tested)

Using function to verify the existence of application folder.

[Files]
Source: "..\..\bin\Release\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\bin\Release\*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full; Excludes: "*.key, *.udb, *.~db, *.crt";  Check: not IsInstalled
Source: "..\..\bin\Release\*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full; Excludes: "*.key, *.udb, *.~db, *.crt, *.sdf, *.config";  Check: IsInstalled

[code]
function IsInstalled: Boolean;
begin
  if DirExists(ExpandConstant('{app}\')) then 
  begin
    Result := True;
  end else
    Result := False;
end;
Alexandre Assis
  • 180
  • 1
  • 7
  • 1
    You can write a single `Check` function and use `not` operator like `Check: not IsInstalled`. – TLama Jan 14 '15 at 17:15
  • You can return simply `Result := DirExists(ExpandConstant('{app}\'));`. But anyway, checking for folder is not a reliable way to detect whether the product is installed. Consider what happens if the user will have accidentally created folder with the same name as `{app}`. Or, what if they choose an existing folder in directory selection page. Better check for uninstall registry settings (or write your own). Here is e.g. a small [`IsUpgrade`](http://stackoverflow.com/a/18531127/960757) function. – TLama Jan 15 '15 at 13:28

1 Answers1

3

Add Check parameter in entry and make sure that check function returns false in update case. Below is the example can be referred.

[Files] Source: "MYPROG.EXE"; DestDir: "{app}"; Check: MyProgCheck

http://www.jrsoftware.org/ishelp/index.php?topic=scriptcheck