@@ -29,16 +29,16 @@ function! rescript#UpdateProjectEnv()
2929 let l: res_bin_dir = finddir (' node_modules/bs-platform/' , " .;" ) . s: rescript_arch
3030
3131 " if !exists("g:rescript_compile_exe")
32- let g: rescript_compile_exe = l: res_bin_dir . " /bsc.exe"
32+ let g: rescript_compile_exe = getcwd () . " / " . l: res_bin_dir . " /bsc.exe"
3333 " endif
3434
3535 " if !exists("g:rescript_build_exe")
36- let g: rescript_build_exe = l: res_bin_dir . " /bsb.exe"
36+ let g: rescript_build_exe = getcwd () . " / " . l: res_bin_dir . " /bsb.exe"
3737 " endif
3838
3939 " Note that this doesn't find bsconfig when the editor was started without a
4040 " specific file within the project
41- let g: rescript_project_config = findfile (" bsconfig.json" , " .;" )
41+ let g: rescript_project_config = getcwd () . " / " . findfile (" bsconfig.json" , " .;" )
4242
4343 " Try to find the nearest .git folder instead
4444 if g: rescript_project_config == " "
@@ -48,7 +48,7 @@ function! rescript#UpdateProjectEnv()
4848 endif
4949
5050 " Make sure that our local working directory is in the rescript_project_root
51- exe " lcd " . g: rescript_project_root
51+ " exe "lcd " . g:rescript_project_root
5252endfunction
5353
5454" Inits the plugin variables, e.g. finding all the plugin related binaries
@@ -93,7 +93,9 @@ function! rescript#DetectVersion()
9393 call rescript#UpdateProjectEnv ()
9494 let l: command = g: rescript_compile_exe . " -version"
9595
96+ exe " lcd " . g: rescript_project_root
9697 silent let l: output = system (l: command )
98+ exe " lcd -"
9799
98100 let l: version_list = matchlist (l: output , ' .* \([0-9]\+\.[0-9]\+\.[0-9]\+.*\) (.*' )
99101
@@ -134,7 +136,9 @@ function! rescript#Format()
134136 " bsc -format myFile.res > tempfile
135137 let l: command = g: rescript_compile_exe . " -color never -format " . l: tmpname . " 2> " . l: stderr_tmpname
136138
139+ exe " lcd " . g: rescript_project_root
137140 silent let l: out = systemlist (l: command )
141+ exe " lcd -"
138142
139143 let l: stderr = readfile (l: stderr_tmpname )
140144
@@ -398,7 +402,9 @@ function! rescript#BuildProject(...)
398402 let l: cmd = g: rescript_build_exe . " " . a: 1
399403 endif
400404
405+ exe " lcd " . g: rescript_project_root
401406 let out = system (l: cmd )
407+ exe " lcd -"
402408
403409 " We don't rely too heavily on exit codes. If there's a compiler.log,
404410 " then there is either an error or a warning, so we rely on the existence
@@ -493,7 +499,6 @@ function! rescript#ReasonToRescript()
493499 endif
494500endfunction
495501
496-
497502function ! rescript#Info ()
498503 let l: version = " ReScript version: " . rescript#DetectVersion ()
499504
0 commit comments