summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-03-15 21:30:13 +0000
committerw0rp <devw0rp@gmail.com>2021-03-15 21:30:13 +0000
commitbd808dca3092f1db56b26e22bc23234f97cb6388 (patch)
tree6fc6e040a94e0a7dd649092d2ff30e9f0b6dc5ba
parentc00852e809a02c12a170b149c7df650d3b0fb36c (diff)
downloadale-bd808dca3092f1db56b26e22bc23234f97cb6388.zip
Fix ale#path#Dirname on Windows
-rw-r--r--autoload/ale/path.vim2
-rw-r--r--test/test_path_dirname.vader5
2 files changed, 6 insertions, 1 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 94de252d..00e31310 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -116,7 +116,7 @@ function! ale#path#Dirname(path) abort
endif
" For /foo/bar/ we need :h:h to get /foo
- if a:path[-1:] is# '/'
+ if a:path[-1:] is# '/' || (has('win32') && a:path[-1:] is# '\')
return fnamemodify(a:path, ':h:h')
endif
diff --git a/test/test_path_dirname.vader b/test/test_path_dirname.vader
index 79b78d29..818a62a8 100644
--- a/test/test_path_dirname.vader
+++ b/test/test_path_dirname.vader
@@ -6,3 +6,8 @@ Execute(ale#path#Dirname should return empty strings should be returned for empt
Execute(ale#path#Dirname should return the dirname of paths):
AssertEqual '/foo', ale#path#Dirname('/foo/bar')
AssertEqual '/foo', ale#path#Dirname('/foo/bar/')
+
+ if has('win32')
+ AssertEqual 'C:\foo', ale#path#Dirname('C:\foo\bar')
+ AssertEqual 'C:\foo', ale#path#Dirname('C:\foo\bar\')
+ endif