os: fix panic on os.is_abs_path('')
parent
26652c8a23
commit
38d16229ef
|
@ -417,6 +417,9 @@ pub fn is_file(path string) bool {
|
||||||
|
|
||||||
// is_abs_path returns `true` if `path` is absolute.
|
// is_abs_path returns `true` if `path` is absolute.
|
||||||
pub fn is_abs_path(path string) bool {
|
pub fn is_abs_path(path string) bool {
|
||||||
|
if path.len == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
$if windows {
|
$if windows {
|
||||||
return path[0] == `/` || // incase we're in MingGW bash
|
return path[0] == `/` || // incase we're in MingGW bash
|
||||||
(path[0].is_letter() && path[1] == `:`)
|
(path[0].is_letter() && path[1] == `:`)
|
||||||
|
|
Loading…
Reference in New Issue