Control page Control:feature:Saving Config
This chapter describes how Config can be saved either into system Registry, or into portable INI files.
Since version 6.0, only modified values are stored into Config, which saves both disk space and resources and time required to save and load Config files. Moreover, it allowes to create hierarchy of Config sets, where for example more global settings can be easily overriden by more local settings. See Cascading Portable INI files for more details about hierarchy of Config sets.
Cascading Portable INI files
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 System Registry for storing Config, or benefit from INI files. Also note that unlike INI files, System 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 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. This is known as Cascading Portable INI files.
- 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. This is known as Cascading Portable INI files.
- 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 of the cascading locations, where an INI file was found upon Config loading. Even if such INI file was deleted in the meantime.
Note: This last of the cascading locations is indicated on the Settings page of the Settings dialog. For example, if an INI file was found in the current working directory, .\TedNPad.ini would be indicated there. If no INI file is found in any searched location, Config will be saved back to System Registry, indicated as System Registry 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|