dictation-toolbox / natlinkcore

Other
4 stars 5 forks source link

NatLink configuration and the $HOME directory #26

Open Voxellence opened 2 years ago

Voxellence commented 2 years ago

The NatLink configuration utility's documentation says the .natlink directory is by default under the $HOME directory.
However, the utility doesn't actually query the $HOME environment variable. Instead it assumes that everyone has left $HOME at its default Windows location, but in my case I have indeed changed it entirely.

I've managed to do a workaround by changing the location of the .natlink directory. I did this by creating and setting a new environment variable...
$NATLINK_USERDIR
...and then using the Windows Environment Variables dialog box to add a New... User variable like...
Variable name: NATLINK_USERDIR
Variable value: %HOME%\.natlink

That way the directory still has the same name but is now actually under $HOME as originally intended. Still, the configuration utility should probably look at the environment variable so that, when the user has changed the path pointed to by $HOME, things work without the user having to define an additional environment variable (NATLINK_USERDIR) due to naïve assumptions made by the configuration utility.

dougransom commented 2 years ago

Interesting. So many programs don't read the $HOME directory and hard code c:... that I have found changing my home directory a path to madness.

dougransom commented 2 years ago

@Voxellence Could you please post the results of running this on your computer?

`S C:\Users\Doug\dictation toolbox\natlinkcore> python Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep 5 2022, 13:51:36) [MSC v.1933 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from pathlib import Path Path.home() WindowsPath('C:/Users/Doug')`

and import os print(os.path.expanduser("~"))

and

Path('~').expanduser()

natlinkcore config.py uses Path.home() to locate the home folder.