win32.c: path_drive
* win32/win32.c (path_drive): extract from winnt_stat, return the drive number in the path, or the current drive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d26965fcdb
commit
0109f86871
@ -5071,6 +5071,14 @@ stat_by_find(const WCHAR *path, struct stati64 *st)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* License: Ruby's */
|
||||||
|
static int
|
||||||
|
path_drive(const WCHAR *path)
|
||||||
|
{
|
||||||
|
return (iswalpha(path[0]) && path[1] == L':') ?
|
||||||
|
towupper(path[0]) - L'A' : _getdrive() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static int
|
static int
|
||||||
winnt_stat(const WCHAR *path, struct stati64 *st)
|
winnt_stat(const WCHAR *path, struct stati64 *st)
|
||||||
@ -5103,8 +5111,7 @@ winnt_stat(const WCHAR *path, struct stati64 *st)
|
|||||||
if (stat_by_find(path, st)) return -1;
|
if (stat_by_find(path, st)) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
st->st_dev = st->st_rdev = (iswalpha(path[0]) && path[1] == L':') ?
|
st->st_dev = st->st_rdev = path_drive(path);
|
||||||
towupper(path[0]) - L'A' : _getdrive() - 1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user