os: fix panic on os.is_abs_path('')

pull/10067/head
Delyan Angelov 2021-05-09 10:45:34 +03:00
parent 26652c8a23
commit 38d16229ef
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 3 additions and 0 deletions

View File

@ -417,6 +417,9 @@ pub fn is_file(path string) bool {
// is_abs_path returns `true` if `path` is absolute.
pub fn is_abs_path(path string) bool {
if path.len == 0 {
return false
}
$if windows {
return path[0] == `/` || // incase we're in MingGW bash
(path[0].is_letter() && path[1] == `:`)