mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Add Windows support to path_is_absolute()
vim-patch:0
This commit is contained in:
parent
c9b29d3884
commit
22e9c51b0f
@ -2186,9 +2186,15 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf,
|
|||||||
|
|
||||||
/// Check if the given file is absolute.
|
/// Check if the given file is absolute.
|
||||||
///
|
///
|
||||||
/// This just checks if the file name starts with '/' or '~'.
|
|
||||||
/// @return `TRUE` if "fname" is absolute.
|
/// @return `TRUE` if "fname" is absolute.
|
||||||
int path_is_absolute_path(const char_u *fname)
|
int path_is_absolute_path(const char_u *fname)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
// A name like "d:/foo" and "//server/share" is absolute
|
||||||
|
return ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
|
||||||
|
|| (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\')));
|
||||||
|
#else
|
||||||
|
// UNIX: This just checks if the file name starts with '/' or '~'.
|
||||||
return *fname == '/' || *fname == '~';
|
return *fname == '/' || *fname == '~';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user