Skip to content

Commit 0167621

Browse files
fhammerschmidtcristianoc
authored andcommitted
Prevent dir from 'eating' the projectRootPath
1 parent 74ba62a commit 0167621

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ export let findProjectRootOfFile = (
3939
};
4040

4141
export let findBinaryFromProjectRoot = (
42-
source: p.DocumentUri
42+
projectRootPath: p.DocumentUri // This must be a directory and not a file!
4343
): null | p.DocumentUri => {
44-
let dir = path.dirname(source);
45-
let bscNativeReScriptPath = path.join(dir, c.nodeModulesBinDir);
44+
let dir = path.dirname(projectRootPath);
45+
let bscNativeReScriptPath = path.join(projectRootPath, c.nodeModulesBinDir);
4646

4747
if (fs.existsSync(bscNativeReScriptPath)) {
4848
return bscNativeReScriptPath;
49-
} else if (dir === source) {
49+
} else if (dir === projectRootPath) {
5050
// reached the top
5151
return null;
5252
} else {

0 commit comments

Comments
 (0)