diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2015-04-13 12:48:35 +0100 |
---|---|---|
committer | Rui Abreu Ferreira <raf-ep@gmx.com> | 2016-08-18 09:41:08 +0100 |
commit | 22e9c51b0f24bd8717d9793a35d741adb9ade797 (patch) | |
tree | 05cb6eb82ad44a47d8be39dba86e5c6edbf824ba /src/nvim/path.c | |
parent | c9b29d3884c380d8de51eb163bbc03cf79a5f886 (diff) | |
download | rneovim-22e9c51b0f24bd8717d9793a35d741adb9ade797.tar.gz rneovim-22e9c51b0f24bd8717d9793a35d741adb9ade797.tar.bz2 rneovim-22e9c51b0f24bd8717d9793a35d741adb9ade797.zip |
Add Windows support to path_is_absolute()
vim-patch:0
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r-- | src/nvim/path.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index c20dffa9b1..4a47a70799 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2186,9 +2186,15 @@ static int path_get_absolute_path(const char_u *fname, char_u *buf, /// Check if the given file is absolute. /// -/// This just checks if the file name starts with '/' or '~'. /// @return `TRUE` if "fname" is absolute. 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 == '~'; +#endif } |