7
votes

How can I set relative path to ini file in ReadIni?

This works:

#define MyAppVersion ReadIni("C:\Users\Popov\Documents\Release\Install.ini", "Release", "VersionNumber")

But I want this:

#define MyAppVersion ReadIni("Install.ini", "Release", "VersionNumber")

Where Install.ini is in the inno script folder.

1

1 Answers

11
votes

Use the SourcePath predefined variable, like this:

SourcePath str. Points to the directory where the current script is located, or the My Documents directory if the script has not yet been saved.

#define MyAppVersion ReadIni(SourcePath + "\Install.ini", "Release", "VersionNumber")

[Setup]
AppName=My Program
AppVersion={#MyAppVersion}