init_homedir()
init_homedir tries to determine the value for VIM's
$HOME variable.
On
Windows, there is typically no
HOME environment variable. Therefore, if
init_homedir finds no
HOME environment variable on Windows, it tries to assign the concatenation of
HOMEDRIVE and
HOMEPATH to
PATH. If this still fails, the value of
%USERPROFILE% is assigned, etc.
If all fails, the value C:\ will be assigned.
The value that was determined is assigned to the global variable static char_u *homedir` (externally defined in
globals.h).
init_homedir() might be called again if encoding changes.
The code of
init_homedir is duplicated in
dosinst.c (to be kept in sync…)
vim_version_dir()
vim_version_dir has one parameter,
char_u *vimdir. The function checks if the directory
vimdir/<version> or
vimdir/runtime exists.
If it does not exist, the function returns NULL, otherwise, it returns the directory name in allocated memory.