Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

IniRootDir property

Project: Window State Components.

Unit: PJWdwState.

Class: TPJWdwState

Applies to: ~>5.5

type
  TPJWdwStateIniRootDir = (
    rdWindowsDir, rdExeDir, rdAppDataDir, rdProgramDataDir
  );

property IniRootDir: TPJWdwStateIniRootDir;

Description

This property determines the root directory to be used for any relative ini file name specified by the IniFileName property.

Possible values are:

Value Notes
rdAppDataDir Places the ini file in a sub-directory of the per user application directory, i.e. %appdata%. If the file name given by IniFileName does not specify the required sub-directory then the file is stored in the %appdata%\DelphiDabbler\WindowStateStore directory.
rdProgramDataDir Places the ini file in a sub-directory of the common application data directory, i.e. %programdata%. If the file name given by IniFileName does not specify the required sub-directory then the file is stored in the %programdata%\DelphiDabbler\WindowStateStore directory.
rdExeDir Places the ini file in the same directory as the program’s executable file. This option should not be used for programs stored in the Program Files directory - see below.
rdWindowsDir Places the ini file in the Windows system directory, i.e. %systemroot%. This option should only be used for backwards compatibility with earlier versions of the component - see below.

In cases where IniFileName is an absolute path IniRootDir is ignored.

The full file path of the ini file can be found by calling the IniFilePath method.

Remarks

The value of IniRootDir can be overridden at run time if you handle either the OnGetIniDataEx event. This can be useful when the AutoSaveRestore property is True and you want to specify the root directory at run time. In this case setting IniRootDir at run time will not work because the form will be restored before you have an opportunity to change the property value. However the OnGetIniDataEx event is triggered before the form restores, enabling the root directory to be specified.

You are strongly recommended not to use the rdWindowsDir value for IniRootDir to store the ini file in the Windows directory. On Windows Vista and later an attempt to write to the Windows directory may be redirected to the virtual store. rdWindowsDir is provided only for backward compatibility will earlier versions of TPJWdwState. See the to get the IniFileName property documentation for more information.

You should set IniRootDir to rdExeDir if the executable program if it is stored in the Program Files directory (or similar), since you may not have write access to it or the file may be redirected to a virtual store. rdExeDir is provided mainly for use with portable programs that save confguration data either with, or in sub-directories or, their installation directory.