dictation-toolbox / natlinkcore

Other
4 stars 4 forks source link

Move config file to AppData/Local #46

Open dougransom opened 1 year ago

dougransom commented 1 year ago

I recently learned this is where settings should go, not in it is kind of like the /etc in unix.

I think we should move the default location for natlink config files to AppData/Local/Natlink.

quintijn commented 1 year ago

This would be a "breaking change" (as Aaron puts it).

This directory could then be overridden by setting NATLINK_USERDIR, but... when we change this, we can also change "NATLINK_USERDIR" into "NATLINK_SETTINGDIR".

Primarily the file "natlink.ini" is then located here.

We find this directory by taking default HOME (~) and go to AppData/Local/Natlink (also forget about that .natlink (dot) convention?).

In this directory, which MUST be local, and clearly is, also some data can/will be stored. For example the vocolagrammars (compiled by the vocola modules), and UnimacroData (where unimacro grammars can store data on its way, for example the grammar _oops, which "remembers" all utterances).

The now existing UnimacroGrammars sub directory is now obsolete, as we take the grammars from the site-packages area directly by now.

Thinking about this, yes, maybe we should move into this.

drmfinlay commented 1 year ago

This seems sensible to me. Was there anything you wanted me to do, Quintijn? Dragonfly doesn't have much to do with Natlink's loading process. The library does have a similar config file in the wrong place on Windows, but it has been scheduled for removal in the next major version.

By the way, there is a built-in environment variable you might use to get the current user's AppData/Local folder: LOCALAPPDATA. It may be accessed in Python like this:

import os
print(os.environ["LOCALAPPDATA"])
quintijn commented 1 year ago

Dane, I think there is nothing you need to do here.

Let us make this change then!!

For users that have a preliminary version of the python3 installer already, we can copy the stuff from HOME/.natlink into LOCALAPPDATA/Natlink, when running the natlinkconfig_gui or natlinkconfig_cli.

The way to change the location of this directory will then be with NATLINK_SETTINGSDIR instead of NATLINK_USERDIR, OK?