Skip to content

Commit f9fe8ab

Browse files
authored
Don't mutate windows.filePath
1 parent c6a4706 commit f9fe8ab

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/validation.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,17 +392,18 @@ const validation = {
392392
return options;
393393
}
394394

395-
if (options.windows.filePath) {
396-
options.windows.filePath = helpers.resolveWindowsEnvironmentVariables(options.windows.filePath);
397-
options.windows.filePath = this.resolvePATH(options.windows.filePath);
395+
let windowsFilePath = options.windows.filePath;
396+
if (windowsFilePath) {
397+
windowsFilePath = helpers.resolveWindowsEnvironmentVariables(windowsFilePath);
398+
windowsFilePath = this.resolvePATH(windowsFilePath);
398399
}
399400

400401
if (
401-
!options.windows.filePath ||
402-
typeof(options.windows.filePath) !== 'string' ||
403-
!fs.existsSync(options.windows.filePath)
402+
!windowsFilePath ||
403+
typeof(windowsFilePath) !== 'string' ||
404+
!fs.existsSync(windowsFilePath)
404405
) {
405-
helpers.throwError(options, 'WINDOWS filePath does not exist: ' + options.windows.filePath);
406+
helpers.throwError(options, 'WINDOWS filePath does not exist: ' + windowsFilePath);
406407
delete options.windows;
407408
}
408409

0 commit comments

Comments
 (0)