[GRASS-dev] does GRASS need HOME to be defined?

Glynn Clements glynn at gclements.plus.com
Wed Dec 7 22:03:35 PST 2016


Helmut Kudrnovsky wrote:

> regarding windows, the configuration directory is defined by the %APPDATA%
> variable; HOME is defined by %HOMEDRIVE% and %HOMEPATH%.
> 
> it expands to:
> 
> >>> import os
> >>> os.getenv('HOME')
> 'C:\\Users\\yourusername'
> >>> os.getenv('APPDATA')
> 'C:\\Users\\yourusername\\AppData\\Roaming'
> 
> would it harm if %HOME% would be extended from _C:\Users\yourusername\_ to
> _C:\Users\yourusername\Documents_ in windows?

Note that:

1. %HOMEPATH% isn't guaranteed to be Users\<username>.

2. The preferred way of referencing that directory is %USERPROFILE%.

3. While %USERPROFILE%\Documents is created automatically, that isn't
guaranteed to be the location of the user's "My Documents" folder (it
can be changed, and in networked environments is typically located on
a file server).

FWIW, the "My Documents" location can be obtained by querying the
registry key

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal

then expanding the result; the default value is "%USERPROFILE\Documents".

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list