Difference between revisions of "Cascading Portable INI files"
m |
|||
Line 17: | Line 17: | ||
#* Note: Current working directory is searched by default. This location can however be explicitly fobidden. To deny reading INI file from current working directory, create an INI file in the primary or secondary INI file location, and in section {{string|[Save]}} add line {{string|<nowiki>IniCWD=0</nowiki>}}. This disables the current working directory INI file location. | #* Note: Current working directory is searched by default. This location can however be explicitly fobidden. To deny reading INI file from current working directory, create an INI file in the primary or secondary INI file location, and in section {{string|[Save]}} add line {{string|<nowiki>IniCWD=0</nowiki>}}. This disables the current working directory INI file location. | ||
# If (and only if) no INI file is found in any searched location, TED Notepad loads {{feature|Config}} from system Registry, particularly user's hive, also known as {{system|HKEY_CURRENT_USER}}. Note: There is no hierarchical loading from system Registry. | # If (and only if) no INI file is found in any searched location, TED Notepad loads {{feature|Config}} from system Registry, particularly user's hive, also known as {{system|HKEY_CURRENT_USER}}. Note: There is no hierarchical loading from system Registry. | ||
+ | |||
+ | Upon {{feature|Config}} saving, all modified options and settings are always written to the last location, where an INI file was found upon {{feature|Config}} loading. Even if such INI file was deleted in the meantime. Note: This ''last known'' location is also indicated on the [[Settings page]] of the {{dialog|Settings}} dialog. | ||
{{tip}} Since each {{feature|Config}} only carries modified options and settings, this hierarchy of primary, secondary and tertiary INI file locations can be used to create hierarchy of global and local {{feature|Config}} sets. While the primary location affects the entire system, the secondary location affects each user separately, and the tertiary location can be effectively used to share project-specific settings and options. | {{tip}} Since each {{feature|Config}} only carries modified options and settings, this hierarchy of primary, secondary and tertiary INI file locations can be used to create hierarchy of global and local {{feature|Config}} sets. While the primary location affects the entire system, the secondary location affects each user separately, and the tertiary location can be effectively used to share project-specific settings and options. | ||
− | |||
− | |||
{{tip}} Setting read-only attribute to the {{system|TedNPad.ini}} prevents TED Notepad from ever saving its {{feature|Config}}. If you set this attribute on an empty file, you can enjoy the default settings forever. | {{tip}} Setting read-only attribute to the {{system|TedNPad.ini}} prevents TED Notepad from ever saving its {{feature|Config}}. If you set this attribute on an empty file, you can enjoy the default settings forever. | ||
Line 26: | Line 26: | ||
{{tip}} Setting hidden attribute to the {{system|TedNPad.ini}} file does not affect {{feature|Config}} loading/saving, but effectively hides the excess file from folders. | {{tip}} Setting hidden attribute to the {{system|TedNPad.ini}} file does not affect {{feature|Config}} loading/saving, but effectively hides the excess file from folders. | ||
− | Administration note: Consider allowing user profile folder INI file location, if installing TED Notepad to {{system|Program Files}} or {{system|SysDir}} folders and creating an INI file there. Also instruct users to create their own INI files in their user profile folders or create them for them. Users might miss privileges to modify system locations, and may thus end up restricted from saving their settings. Although current working directory location may be sufficient in some cases, it can be very frustrating for most users. | + | '''Administration note''': Consider allowing user profile folder INI file location, if installing TED Notepad to {{system|Program Files}} or {{system|SysDir}} folders and creating an INI file there. Also instruct users to create their own INI files in their user profile folders or create them for them. Users might miss privileges to modify system locations, and may thus end up restricted from saving their settings. Although current working directory location may be sufficient in some cases, it can be very frustrating for most users. |
{{example_start}}{{tip}} Example of INI file enabling secondary and tertiary INI file locations: | {{example_start}}{{tip}} Example of INI file enabling secondary and tertiary INI file locations: |
Revision as of 22:14, 7 May 2012
Besides system Registry, TED Notepad offers to save its Config into a hierarchy of portable INI files instead. These INI files are quite easily manageable, editable and moveable from one computer to another. They can be stored on USB flash disks, and most importantly, they offer possibility to setup different Config for each different working directory.
Note: Using INI files prevents using system Registry altogether. One can either use Registry for storing Config, or benefit from INI files. Also note that unlike INI files, Registry cannot offer per-working-directory Config storing.
The INI file must always be named TedNPad.ini in order to be recognized by TED Notepad. The name is usually case insensitive
, but if using Wine under Linux (or other such emulators), make sure the name is case sensitive
. Common mistake is to name the INI file according to the application exe file. This is wrong, an INI file must always be named TedNPad.ini.
The INI file must be encoded in UTF-8 with BOM. This is mandatory. TED Notepad will not bother with verifications and/or conversions, and will simply reject invalid files. Keep this in mind if editing INI files manually.
There are several locations, where TedNPad.ini is being looked for. Their order is following:
- Directory, where the application executable file is stored, is searched. This is the primary INI file location. If an INI file is found here, Config is read from it, and any loaded values override application default values.
- (Only if explicitly requested) User profile folder is searched, i.e. the %UserProfile% directory. This is the secondary INI file location. If an INI file is found here, Config is read from it, and loaded values override any previously loaded values (e.g. from the primary INI file location) wherever they conflict.
- Note: User profile folder is not searched by default. This location must be explicitly requested. To request reading INI file from user profile folder, create an INI file in the primary INI file location, and in section [Save] add line IniUPF=1. This enables the user profile folder INI file location.
- (If not explicitly fobidden) Current working directory is searched, i.e. the directory from which the application was launched. If launching the application thru Shortcut on Desktop, it is the starting directory from the Shortcut's properties dialog. This is the tertiary INI file location. If an INI file is found here, Config is read from it, and loaded values override any previously loaded values (e.g. from the primary and/or secondary INI file locations) wherever they conflict.
- Note: Current working directory is searched by default. This location can however be explicitly fobidden. To deny reading INI file from current working directory, create an INI file in the primary or secondary INI file location, and in section [Save] add line IniCWD=0. This disables the current working directory INI file location.
- If (and only if) no INI file is found in any searched location, TED Notepad loads Config from system Registry, particularly user's hive, also known as HKEY_CURRENT_USER. Note: There is no hierarchical loading from system Registry.
Upon Config saving, all modified options and settings are always written to the last location, where an INI file was found upon Config loading. Even if such INI file was deleted in the meantime. Note: This last known location is also indicated on the Settings page of the Settings dialog.
Tip: Since each Config only carries modified options and settings, this hierarchy of primary, secondary and tertiary INI file locations can be used to create hierarchy of global and local Config sets. While the primary location affects the entire system, the secondary location affects each user separately, and the tertiary location can be effectively used to share project-specific settings and options.
Tip: Setting read-only attribute to the TedNPad.ini prevents TED Notepad from ever saving its Config. If you set this attribute on an empty file, you can enjoy the default settings forever.
Tip: Setting hidden attribute to the TedNPad.ini file does not affect Config loading/saving, but effectively hides the excess file from folders.
Administration note: Consider allowing user profile folder INI file location, if installing TED Notepad to Program Files or SysDir folders and creating an INI file there. Also instruct users to create their own INI files in their user profile folders or create them for them. Users might miss privileges to modify system locations, and may thus end up restricted from saving their settings. Although current working directory location may be sufficient in some cases, it can be very frustrating for most users.
[Save] IniUPF=1 ; User profile folder ; 1=read ; 0=skip IniCWD=1 ; Current working directory ; 1=read ; 0=skip |