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 = (_) => {};
67
67
68
68
let getBinaryDirPath = ( projectRootPath : p . DocumentUri ) =>
69
69
extensionConfiguration . binaryPath === null
70
- ? utils . findBinaryFromProjectRoot ( projectRootPath )
70
+ ? utils . findBinaryDirPathFromProjectRoot ( projectRootPath )
71
71
: extensionConfiguration . binaryPath ;
72
72
73
73
let findRescriptBinary = ( projectRootPath : p . DocumentUri ) =>
Original file line number Diff line number Diff line change @@ -38,24 +38,23 @@ export let findProjectRootOfFile = (
38
38
}
39
39
} ;
40
40
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!
43
43
) : 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 ) {
54
53
// reached the top
55
54
return null ;
56
- } else {
57
- return findBinaryFromProjectRoot ( dir ) ;
58
55
}
56
+
57
+ return findBinaryDirPathFromProjectRoot ( parentDir ) ;
59
58
} ;
60
59
61
60
export let findBinary = (
You can’t perform that action at this time.
0 commit comments