mirror of https://github.com/dense-analysis/ale
Fix ale#path#Dirname on Windows
This commit is contained in:
parent
c00852e809
commit
bd808dca30
|
@ -116,7 +116,7 @@ function! ale#path#Dirname(path) abort
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" For /foo/bar/ we need :h:h to get /foo
|
" 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')
|
return fnamemodify(a:path, ':h:h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -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):
|
Execute(ale#path#Dirname should return the dirname of paths):
|
||||||
AssertEqual '/foo', ale#path#Dirname('/foo/bar')
|
AssertEqual '/foo', ale#path#Dirname('/foo/bar')
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue