From d0e7d0070d896724e8fb1829b02d0df205744a69 Mon Sep 17 00:00:00 2001 From: aguspiza Date: Fri, 12 Jul 2019 19:05:22 +0200 Subject: [PATCH] fix travis windows user home --- compiler/cgen.v | 1 + vlib/os/os.v | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/cgen.v b/compiler/cgen.v index a6e2edb5f9..dfc3e7713a 100644 --- a/compiler/cgen.v +++ b/compiler/cgen.v @@ -33,6 +33,7 @@ mut: } fn new_cgen(out_name_c string) *CGen { + //println('TmpPath: "$TmpPath"') path:='$TmpPath/$out_name_c' out := os.create(path) or { println('failed to create $path') diff --git a/vlib/os/os.v b/vlib/os/os.v index 973822e9c8..fd2cb52fe1 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -459,7 +459,14 @@ pub fn home_dir() string { mut home := os.getenv('HOME') $if windows { home = os.getenv('HOMEDRIVE') - home += os.getenv('HOMEPATH') + if home.len == 0 { + home = os.getenv('SYSTEMDRIVE') + } + mut homepath := os.getenv('HOMEPATH') + if homepath.len == 0 { + homepath = '\\Users\\' + os.getenv('USERNAME') + } + home += homepath } home += '/' return home