Skip to content

Commit

Permalink
Remove junking of paths in zip output
Browse files Browse the repository at this point in the history
  • Loading branch information
younglim committed Apr 27, 2024
1 parent a900d15 commit 85f28d8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,22 @@ export const zipResults = (zipName, resultsPath) => {
throw err;
}
} else {
// To zip up files recursively )-r) in the results folder path
// Will only zip up the content of the results folder path with (-j) i.e. junk the path
// Get zip command in Mac and Linux
const command = '/usr/bin/zip';
const args = ['-r', '-j', zipName, resultsPath];
// Check if user specified absolute or relative path
const zipFilePath = path.isAbsolute(zipName) ? zipName : path.join(process.cwd(), zipName);

// To zip up files recursively (-r) in the results folder path and write it to user's specified path
const args = ['-r', zipFilePath, '.'];

// Change working directory only for the zip command
const options = {
cwd: resultsPath
};

try {
execFileSync(command, args);
// Zip results
spawnSync(command, args, options);
} catch (err) {
throw err;
}
Expand Down

0 comments on commit 85f28d8

Please sign in to comment.