Come aggiungi le stringhe calcolate per l'installazione relative agli script di innostiTUP?
-
11-12-2019 - |
Domanda
Attualmente quando aggiorno un programma I eseguire il backup dei file esistenti in una cartella denominata Backup nella directory dei programmi, ad esempio.
Source: "{app}\filename.exe"; DestDir: "{app}\backup"; Flags: external skipifsourcedoesntexist uninsneveruninstall
.
C'è un modo per specificare o calcolare stringhe in modo che il codice sia qualcosa come
Source: "{app}\filename.exe"; DestDir: "{app}\backup{date}"; Flags: external skipifsourcedoesntexist uninsneveruninstall
.
o combina una data con informazioni sulla versione precedente
Source: "{app}\filename.exe"; DestDir: "{app}\backup{previous version}{date}"; Flags: external skipifsourcedoesntexist uninsneveruninstall
. Soluzione
Please read Pascal Scripting: Scripted Constants and Pascal Scripting: Support Functions Reference. Also read this and this. Anyway, this is how I did it:
[Dirs]
; create an empty folder...
Name: "{app}\{code:MyDateTimeString}"
[Code]
function MyDateTimeString(Param: String): String;
begin
Result := GetDateTimeString('yyyy.mm.dd_hh.nn.ss', #0, #0);
end;
Altri suggerimenti
You can add runtime dynamic values using {code:...}
constants.
An example of getting the current date and making a backup of the installation folder can be seen on the ISXKB wiki
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow