Difference between revisions of "Saving Config"

From TED Notepad
 
Line 5: Line 5:
 
In TED Notepad, a {{feature|Config}} is a set of all modified settings and options from the entire application. This includes the {{menu|Options}} menu, the {{dialog|Settings}} dialog, various {{menu|Tools}} options, {{feature|Clips}}, etc.
 
In TED Notepad, a {{feature|Config}} is a set of all modified settings and options from the entire application. This includes the {{menu|Options}} menu, the {{dialog|Settings}} dialog, various {{menu|Tools}} options, {{feature|Clips}}, etc.
  
Since version 6.0, only modified values are stored into {{feature|Config}}, which saves both disk space and resources and time required to save and load {{feature|Config}} files. Moreover, it allowes to create hierarchy of {{feature|Config}} sets, where for example more global settings can be easily overriden by more local settings. See [[Portable INI file]] for more details about hierarchy of {{feature|Config}} sets.
+
Since version 6.0, only modified values are stored into {{feature|Config}}, which saves both disk space and resources and time required to save and load {{feature|Config}} files. Moreover, it allowes to create hierarchy of {{feature|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 {{feature|Config}} sets.
  
 
<includeonly>=====Table of Contents:=====
 
<includeonly>=====Table of Contents:=====
*[[Portable INI file]]</includeonly>
+
*[[Cascading Portable INI files]]</includeonly>
 
<noinclude>{{:Cascading Portable INI files}}</noinclude>
 
<noinclude>{{:Cascading Portable INI files}}</noinclude>

Latest revision as of 11:17, 22 September 2019

This section is up to date for TED Notepad version 6.3.1.0.
Control page Control:feature:Saving Config
This section is up to date for TED Notepad version 6.3.1.0.
Control page Control:feature:Config

This chapter describes how Config can be saved either into system Registry, or into portable INI files.

In TED Notepad, a Config is a set of all modified settings and options from the entire application. This includes the Options menu, the Settings dialog, various Tools options, Clips, etc.

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 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:

  1. 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.
  2. (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.
  3. (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.
  4. 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.

Example: INI file enabling secondary and tertiary INI file locations:
[Save] IniUPF=1 ; User profile folder ; 1=read ; 0=skip IniCWD=1 ; Current working directory ; 1=read ; 0=skip