Skip to content

Commit

Permalink
Don't mutate windows.filePath
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyd710 authored Jan 6, 2024
1 parent c6a4706 commit f9fe8ab
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,18 @@ const validation = {
return options;
}

if (options.windows.filePath) {
options.windows.filePath = helpers.resolveWindowsEnvironmentVariables(options.windows.filePath);
options.windows.filePath = this.resolvePATH(options.windows.filePath);
let windowsFilePath = options.windows.filePath;
if (windowsFilePath) {
windowsFilePath = helpers.resolveWindowsEnvironmentVariables(windowsFilePath);
windowsFilePath = this.resolvePATH(windowsFilePath);
}

if (
!options.windows.filePath ||
typeof(options.windows.filePath) !== 'string' ||
!fs.existsSync(options.windows.filePath)
!windowsFilePath ||
typeof(windowsFilePath) !== 'string' ||
!fs.existsSync(windowsFilePath)
) {
helpers.throwError(options, 'WINDOWS filePath does not exist: ' + options.windows.filePath);
helpers.throwError(options, 'WINDOWS filePath does not exist: ' + windowsFilePath);
delete options.windows;
}

Expand Down

0 comments on commit f9fe8ab

Please sign in to comment.