__FILE__

InstallShield 2022 ยป InstallScript Language Reference

During script compilation this reserved identifier is replaced by a string that contains the fully qualified name of the source file in which __FILE__ resides. __FILE__ can be specified anywhere in a script where a string constant is allowed, but it is most useful when used with __LINE__ for simple debugging. For example, by constructing a statement like the one below and copying it to strategic locations in your source files during testing, you can easily associate specific parts of your setup with specific sections of your script as you observe your setup run.

    SprintfBox (INFORMATION, "", "File: %s\nLine:%ld";,

               __FILE__, __LINE__);

Note that the path will be the location from which the file was compiled, not the location from which the setup is being run. If necessary, the ParsePath function can be called with __FILE__ in the second parameter to extract parts of the fully qualified file name. The code fragment below extracts the file name and displays it.

    ParsePath (svReturnString, __FILE__, FILENAME);

    MessageBox (svReturnString, INFORMATION);

For more complete and powerful debugging, use the InstallScript Debugger by clicking Debug on the Build menu in InstallShield. For more information, see the InstallScript Debugger Help.

See Also