Skip to content

Commit 59d76ce

Browse files
Prefer R path from PATH (#142)
1 parent 8cbf304 commit 59d76ce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ function getRfromEnvPath(platform: string) {
3939

4040
export async function getRpathFromSystem(): Promise<string> {
4141

42-
let rpath: string = '';
42+
let rpath = '';
4343
const platform: string = process.platform;
4444

45-
if ( platform === 'win32') {
45+
rpath ||= getRfromEnvPath(platform);
46+
47+
if ( !rpath && platform === 'win32') {
4648
// Find path from registry
4749
try {
4850
const key = new winreg({
@@ -57,8 +59,6 @@ export async function getRpathFromSystem(): Promise<string> {
5759
}
5860
}
5961

60-
rpath ||= getRfromEnvPath(platform);
61-
6262
return rpath;
6363
}
6464

0 commit comments

Comments
 (0)