summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/path.vim6
-rw-r--r--test/util/test_cd_string_commands.vader18
2 files changed, 19 insertions, 5 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 2d8a6ac7..6d804459 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -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> && '
diff --git a/test/util/test_cd_string_commands.vader b/test/util/test_cd_string_commands.vader
index 5f0e92fd..04de4052 100644
--- a/test/util/test_cd_string_commands.vader
+++ b/test/util/test_cd_string_commands.vader
@@ -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