innoextract icon indicating copy to clipboard operation
innoextract copied to clipboard

Improve handling of constants (variables) in filenames

Open dscharrer opened this issue 11 years ago • 0 comments

Currently we replace constants with their names and parameters. This is a sensible default for most constants - although an --install option that uses proper default/user supplied values could be useful.

However, this produces ugly results for some special constants:

  • environment variables: {%NAME|DefaultValue}
  • ini values: {ini:Filename,Section,Key|DefaultValue}
  • custom messages: {cm:MessageName}, {cm:MessageName,Arguments}
  • registry keys: {reg:HKxx\SubkeyName,ValueName|DefaultValue}
  • command-line parameters: {param:ParamName|DefaultValue}
  • built-in functions: {drive:Path}
  • user code: {code:FunctionName|Param}

Here, using the referenced or default value would be a better approach. The only real problem is user code - adding complete support for that may be out of the scope of this project. However, at least the GOG.com installers for DOSBox-based games use this, so some support is a good idea.

Additionally, we need to handle percent-encoded characters in constants/constant names.

Inno Setup constants are documented here and here.

Note: the constants are not only used in filenames - for example the "program name" in recent installers for Inno Setup itself uses something like "{cm:NameAndVersion,Inno Setup,5.1.10}" - that needs to be expanded as well.

dscharrer avatar Mar 12 '13 23:03 dscharrer