mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
windows: use %USERPROFILE% for os.home_dir()
This commit is contained in:
parent
2ea2fed8a5
commit
2e1dbd9f5a
15
vlib/os/os.v
15
vlib/os/os.v
@ -785,20 +785,11 @@ pub fn user_os() string {
|
||||
|
||||
// home_dir returns path to user's home directory.
|
||||
pub fn home_dir() string {
|
||||
mut home := os.getenv('HOME')
|
||||
$if windows {
|
||||
home = os.getenv('HOMEDRIVE')
|
||||
if home.len == 0 {
|
||||
home = os.getenv('SYSTEMDRIVE')
|
||||
return os.getenv('USERPROFILE') + filepath.separator
|
||||
} $else {
|
||||
return os.getenv('HOME') + filepath.separator
|
||||
}
|
||||
mut homepath := os.getenv('HOMEPATH')
|
||||
if homepath.len == 0 {
|
||||
homepath = '\\Users\\' + os.getenv('USERNAME')
|
||||
}
|
||||
home += homepath
|
||||
}
|
||||
home += filepath.separator
|
||||
return home
|
||||
}
|
||||
|
||||
// write_file writes `text` data to a file in `path`.
|
||||
|
Loading…
Reference in New Issue
Block a user