mirror of
https://github.com/dense-analysis/ale
synced 2024-12-25 23:52:22 +00:00
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
|
||||
return 'cd ' . ale#Escape(a:directory) . ' && '
|
||||
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.
|
||||
AssertEqual
|
||||
\ has('unix') ? 'cd ''/foo bar/baz'' && ' : 'cd "/foo bar/baz" && ',
|
||||
\ ale#path#CdString('/foo bar/baz')
|
||||
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')
|
||||
|
||||
AssertEqual 'cd ' . ale#Escape(g:dir) . ' && ', ale#path#BufferCdString(bufnr(''))
|
||||
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
Block a user