File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ let send: (msg: p.Message) => void = (_) => {};
6767
6868let getBinaryDirPath = ( projectRootPath : p . DocumentUri ) =>
6969 extensionConfiguration . binaryPath === null
70- ? utils . findBinaryFromProjectRoot ( projectRootPath )
70+ ? utils . findBinaryDirPathFromProjectRoot ( projectRootPath )
7171 : extensionConfiguration . binaryPath ;
7272
7373let findRescriptBinary = ( projectRootPath : p . DocumentUri ) =>
Original file line number Diff line number Diff line change @@ -38,24 +38,23 @@ export let findProjectRootOfFile = (
3838 }
3939} ;
4040
41- export let findBinaryFromProjectRoot = (
42- projectRootPath : p . DocumentUri // This must be a directory and not a file!
41+ export let findBinaryDirPathFromProjectRoot = (
42+ directory : p . DocumentUri // This must be a directory and not a file!
4343) : null | p . DocumentUri => {
44- let dir = path . dirname ( projectRootPath ) ;
45- let bscNativeReScriptPath = path . join (
46- projectRootPath ,
47- c . nodeModulesBinDir ,
48- c . bscBinName
49- ) ;
50-
51- if ( fs . existsSync ( bscNativeReScriptPath ) ) {
52- return path . dirname ( bscNativeReScriptPath ) ;
53- } else if ( dir === projectRootPath ) {
44+ let binaryDirPath = path . join ( directory , c . nodeModulesBinDir ) ;
45+ let binaryPath = path . join ( binaryDirPath , c . rescriptBinName ) ;
46+
47+ if ( fs . existsSync ( binaryPath ) ) {
48+ return binaryDirPath ;
49+ }
50+
51+ let parentDir = path . dirname ( directory ) ;
52+ if ( parentDir === directory ) {
5453 // reached the top
5554 return null ;
56- } else {
57- return findBinaryFromProjectRoot ( dir ) ;
5855 }
56+
57+ return findBinaryDirPathFromProjectRoot ( parentDir ) ;
5958} ;
6059
6160export let findBinary = (
You can’t perform that action at this time.
0 commit comments