Reputation:
I wanted to know how to control the language of inno setup, I would like that when the user selects the English inno setup after installation eliminates the Italian language files, but if the user selects the Italian language, I would like that after the installation would remove the language file English. I tried this code but does not work:
[InstallDelete]
#if {language} = "english"
Type: files; Name: "{commondesktop}\english.txt"
#if {language} = "italian"
Type: files; Name: "{commondesktop}\italian.txt"
#endif
Thanks.
Sorry for my English.
Upvotes: 2
Views: 2548
Reputation: 54792
Directives are evaluated at compile time, and in any case [InstallDelete] section is processed at the beginning of the setup. The easiest approach for your case, I believe, is to not install the file in the first place if the user has not chosen the corresponding setup language:
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
[Files]
Source: "english.txt"; DestDir: "{commondesktop}"; Languages: en;
Source: "italian.txt"; DestDir: "{commondesktop}"; Languages: it;
If I have somehow misunderstood the question, you can use the DeleteFile
support function in code to delete a file, for instance in a CurStepChanged
procedure while CurStep
is 'ssDone' or 'ssPostInstall'.
Upvotes: 4