[vbox-dev] Location of VirtualBox configuration file

Knut St. Osmundsen knut.osmundsen at oracle.com
Mon Nov 21 11:03:36 GMT 2016


Hi Malcom.

On 2016-11-20 7:55 PM, Malcolm Clarke wrote:
>
> Dear Max
>
> Still no response.
>
> Looking at path-win.cpp, the following code is unclear
>
>
> RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath)
> {
[snip]
>
> Assuming this falls through to get the environment variable, then
> USERPROFILE is used over %HOMEDRIVE%%HOMEPATH%, however in most other
> places %HOMEDRIVE%%HOMEPATH% alone is used. This appears to result in
> inconsistent behaviour if USERPROFILE is not equal to
> %HOMEDRIVE%%HOMEPATH%.
>
> This needs to be remedied for people using roaming profiles when these
> environmental variables can be set differently.
>
> 1. %HOMEDRIVE%%HOMEPATH% is used for location of configuration files
> (create and check location for existence)
> 2. USERPROFILE  may be used for temporary files
>

The code is crystal clear in my opinion, it also compares well to what
for instance Python does in its ntpath.expanduser() implementation
(preferring USERPROFILE over HOMEDRIVE+HOMEPATH).  All our code is using
RTPathUserHome.

Whether we should've put the configuration files in the root of the user
home directory on windows is a very good question, but it shouldn't
influence the operation of RTPathUserHome.  The reason why it is where
it is, goes back to the early days where we also put virtual machines in
subfolders of %USERPROFILE%\VirtualBox and wanted to have them easily
accessible by the user using explorer.

Kind regards,
 bird.





More information about the vbox-dev mailing list