1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: small cleanup of needless r'\' usage

This commit is contained in:
Delyan Angelov 2022-08-22 16:32:37 +03:00
parent e156e6a44a
commit 21917f5b00
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -199,7 +199,7 @@ pub fn dir(opath string) string {
if opath == '' {
return '.'
}
path := opath.replace_each(['/', path_separator, r'\', path_separator])
path := opath.replace_each(['/', path_separator, '\\', path_separator])
pos := path.last_index(path_separator) or { return '.' }
if pos == 0 && path_separator == '/' {
return '/'
@ -215,7 +215,7 @@ pub fn base(opath string) string {
if opath == '' {
return '.'
}
path := opath.replace_each(['/', path_separator, r'\', path_separator])
path := opath.replace_each(['/', path_separator, '\\', path_separator])
if path == path_separator {
return path_separator
}
@ -231,7 +231,7 @@ pub fn base(opath string) string {
// file_name will return all characters found after the last occurence of `path_separator`.
// file extension is included.
pub fn file_name(opath string) string {
path := opath.replace_each(['/', path_separator, r'\', path_separator])
path := opath.replace_each(['/', path_separator, '\\', path_separator])
return path.all_after_last(path_separator)
}
@ -431,7 +431,7 @@ fn executable_fallback() string {
}
}
if !is_abs_path(exepath) {
rexepath := exepath.replace_each(['/', path_separator, r'\', path_separator])
rexepath := exepath.replace_each(['/', path_separator, '\\', path_separator])
if rexepath.contains(path_separator) {
exepath = join_path_single(os.wd_at_startup, exepath)
} else {