Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Message
| There have been numerous requests in the past to have MUSHclient not keep its global preferences in the Windows Registry. There are a number of problems with the Registry, one being that it is hard to move a MUSHclient installation from one PC to another without a lot of mucking around saving and restoring Registry values.
Now that SQLite support is included in MUSHclient, it seemed a good time to revisit this.
Version 4.40 now moves the global preferences, and window locations, from the Registry to a SQLite database. To help understand how this works, I will describe below how this is implemented.
First, we need to decide where this global preferences file is going to be found. Obviously, storing its location in the Registry would defeat the purpose of these changes.
MUSHclient now tries this strategy to find the database file:
- It looks first in the "startup directory". This is the directory it finds itself in when first invoked. You can alter that by making a shortcut to MUSHclient.exe, and setting the "Start in" location in the shortcut properties.
The reason for doing that is that you can have custom global preferences by simply having different startup directories. For example, one for you and one for your brother or sister.
It looks for the file "mushclient_prefs.sqlite". If found, this file is used for the preferences database.
- Next, if that file is not found, it looks in the MUSHclient application directory. That is, the directory that MUSHclient.exe is actually located. This lets you have a single global preferences file, even if you use different startup directories.
- If the preferences file is still not found, it is opened in the startup directory (and created from scratch).
If the preferences file needs to be created, three tables are created in it:
- control - for various top-level parameters, like, the order of the columns in the trigger list.
- prefs - global preferences
- worlds - the location of the windows in the various world files as they are opened.
Next, existing global preferences (if any) are copied from the Registry to the database. That way your existing preferences are not lost.
However the other things stored in the Registry are not copied over, for simplicity. Thus you will find that your world windows will revert to their default positions, the columns in the configuration windows will revert to their default, and so on.
You can find the location of the preferences database by doing GetInfo (82). You could open the preferences file yourself to change global preferences if you wanted to (using the sqlite3.exe program you can download from the SQLite web site, or by doing it in scripting).
For example, you can look at the preferences like this:
sqlite3 mushclient_prefs.sqlite
sqlite> .mode csv
sqlite> select * from prefs;
AllTypingToCommandWindow,1
AlwaysOnTop,0
AppendToLogFiles,0
AutoConnectWorlds,1
AutoExpandConfig,1
FlatToolbars,1
AutoLogWorld,0
BleedBackground,0
ColourGradientConfig,1
ConfirmBeforeClosingMXPdebug,0
ConfirmBeforeClosingMushclient,0
ConfirmBeforeClosingWorld,0
ConfirmBeforeSavingVariables,0
ConfirmLogFileClose,1
EnableSpellCheck,0
AllowLoadingDlls,0
F1macro,0
FixedFontForEditing,1
NotepadWordWrap,1
NotifyIfCannotConnect,1
ErrorNotificationToOutputWindow,0
... and so on ...
sqlite> .exit
An example of changing a global preference offline would be:
sqlite3 mushclient_prefs.sqlite
sqlite> UPDATE prefs SET value = 1 WHERE name = 'EnableSpellCheck';
sqlite> .exit
To discard all global preferences (which is like reinstalling MUSHclient after removing it), simply delete the mushclient_prefs.sqlite database. That forces it to be recreated. However if you still have preferences in the Registry they will be used as the basis for recreation.
So, to totally revert to defaults, do this:
- Close MUSHclient
- Uninstall MUSHclient
- Delete the file mushclient_prefs.sqlite in the MUSHclient executable directory, or the MUSHclient startup directory.
- Reinstall MUSHclient
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|