From 2e1dbd9f5a00de9c09782dd62ae0708ebdfd6798 Mon Sep 17 00:00:00 2001 From: vitalyster Date: Tue, 18 Feb 2020 04:12:10 +0300 Subject: [PATCH] windows: use %USERPROFILE% for os.home_dir() --- vlib/os/os.v | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 0f4486c291..35ab287a1f 100644 --- a/vlib/os/os.v +++ b/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') - } - mut homepath := os.getenv('HOMEPATH') - if homepath.len == 0 { - homepath = '\\Users\\' + os.getenv('USERNAME') - } - home += homepath + return os.getenv('USERPROFILE') + filepath.separator + } $else { + return os.getenv('HOME') + filepath.separator } - home += filepath.separator - return home } // write_file writes `text` data to a file in `path`.