mirror of https://github.com/dense-analysis/ale
fix CdString for MS Windows
This commit is contained in:
parent
f57ad883f2
commit
eae3f70e75
|
@ -65,7 +65,11 @@ endfunction
|
|||
" Output 'cd <directory> && '
|
||||
" This function can be used changing the directory for a linter command.
|
||||
function! ale#path#CdString(directory) abort
|
||||
if has('win32')
|
||||
return 'cd /d ' . ale#Escape(a:directory) . ' && '
|
||||
else
|
||||
return 'cd ' . ale#Escape(a:directory) . ' && '
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Output 'cd <buffer_filename_directory> && '
|
||||
|
|
|
@ -8,11 +8,21 @@ After:
|
|||
|
||||
Execute(CdString should output the correct command string):
|
||||
" We will check that escaping is done correctly for each platform.
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ 'cd /d "/foo bar/baz" && ',
|
||||
\ ale#path#CdString('/foo bar/baz')
|
||||
else
|
||||
AssertEqual
|
||||
\ has('unix') ? 'cd ''/foo bar/baz'' && ' : 'cd "/foo bar/baz" && ',
|
||||
\ ale#path#CdString('/foo bar/baz')
|
||||
endif
|
||||
|
||||
Execute(BufferCdString should output the correct command string):
|
||||
call ale#test#SetFilename('foo.txt')
|
||||
|
||||
if has('win32')
|
||||
AssertEqual 'cd /d ' .ale#Escape(g:dir) . ' && ', ale#path#BufferCdString(bufnr(''))
|
||||
else
|
||||
AssertEqual 'cd ' . ale#Escape(g:dir) . ' && ', ale#path#BufferCdString(bufnr(''))
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue