mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: home_dir() remove trailing slash (#6512)
This commit is contained in:
parent
76e373a5f4
commit
3a8be4d8d9
@ -533,7 +533,7 @@ fn init_settings() {
|
||||
s.is_help = '-h' in os.args || '--help' in os.args || 'help' in os.args
|
||||
s.is_verbose = '-v' in os.args
|
||||
s.server_urls = cmdline.options(os.args, '-server-url')
|
||||
s.vmodules_path = os.home_dir() + '.vmodules'
|
||||
s.vmodules_path = os.join_path(os.home_dir(), '.vmodules')
|
||||
}
|
||||
|
||||
fn verbose_println(s string) {
|
||||
|
@ -651,7 +651,6 @@ pub fn dir(path string) string {
|
||||
}
|
||||
|
||||
// base_dir will return the base directory of `path`.
|
||||
// The `path_separator` is included.
|
||||
pub fn base_dir(path string) string {
|
||||
posx := path.last_index(path_separator) or {
|
||||
return path.clone()
|
||||
@ -824,12 +823,12 @@ pub fn user_os() string {
|
||||
// home_dir returns path to user's home directory.
|
||||
pub fn home_dir() string {
|
||||
$if windows {
|
||||
return os.getenv('USERPROFILE') + os.path_separator
|
||||
return os.getenv('USERPROFILE')
|
||||
} $else {
|
||||
//println('home_dir() call')
|
||||
//res:= os.getenv('HOME') + os.path_separator
|
||||
//res:= os.getenv('HOME')
|
||||
//println('res="$res"')
|
||||
return os.getenv('HOME') + os.path_separator
|
||||
return os.getenv('HOME')
|
||||
}
|
||||
}
|
||||
|
||||
@ -1275,7 +1274,7 @@ pub fn cache_dir() string {
|
||||
return xdg_cache_home
|
||||
}
|
||||
}
|
||||
cdir := os.home_dir() + '.cache'
|
||||
cdir := os.join_path(os.home_dir(), '.cache')
|
||||
if !os.is_dir(cdir) && !os.is_link(cdir) {
|
||||
os.mkdir(cdir) or {
|
||||
panic(err)
|
||||
|
@ -10,7 +10,7 @@ pub const (
|
||||
)
|
||||
|
||||
fn mpath() string {
|
||||
return os.home_dir() + '.vmodules'
|
||||
return os.join_path(os.home_dir(), '.vmodules')
|
||||
}
|
||||
|
||||
pub fn new_preferences() Preferences {
|
||||
|
Loading…
Reference in New Issue
Block a user