diff --git a/src/util.ts b/src/util.ts index 81eda6813..dc1e70b61 100644 --- a/src/util.ts +++ b/src/util.ts @@ -35,7 +35,9 @@ export async function getRpathFromSystem(): Promise { let rpath = ''; const platform: string = process.platform; - if ( platform === 'win32') { + rpath ||= getRfromEnvPath(platform); + + if ( !rpath && platform === 'win32') { // Find path from registry try { const key = new winreg({ @@ -50,8 +52,6 @@ export async function getRpathFromSystem(): Promise { } } - rpath ||= getRfromEnvPath(platform); - return rpath; }