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:
parent
e156e6a44a
commit
21917f5b00
@ -199,7 +199,7 @@ pub fn dir(opath string) string {
|
|||||||
if opath == '' {
|
if opath == '' {
|
||||||
return '.'
|
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 '.' }
|
pos := path.last_index(path_separator) or { return '.' }
|
||||||
if pos == 0 && path_separator == '/' {
|
if pos == 0 && path_separator == '/' {
|
||||||
return '/'
|
return '/'
|
||||||
@ -215,7 +215,7 @@ pub fn base(opath string) string {
|
|||||||
if opath == '' {
|
if opath == '' {
|
||||||
return '.'
|
return '.'
|
||||||
}
|
}
|
||||||
path := opath.replace_each(['/', path_separator, r'\', path_separator])
|
path := opath.replace_each(['/', path_separator, '\\', path_separator])
|
||||||
if path == path_separator {
|
if path == path_separator {
|
||||||
return 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_name will return all characters found after the last occurence of `path_separator`.
|
||||||
// file extension is included.
|
// file extension is included.
|
||||||
pub fn file_name(opath string) string {
|
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)
|
return path.all_after_last(path_separator)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ fn executable_fallback() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !is_abs_path(exepath) {
|
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) {
|
if rexepath.contains(path_separator) {
|
||||||
exepath = join_path_single(os.wd_at_startup, exepath)
|
exepath = join_path_single(os.wd_at_startup, exepath)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user