fix: missing forward slash

This commit is contained in:
papeloto 2020-03-21 13:11:41 +01:00
parent a1b75eab61
commit a77ec1c880
2 changed files with 10 additions and 10 deletions

10
dist/index.js vendored
View file

@ -70,20 +70,20 @@ console.log(`Ready to zip "${files}" into ${output}`);
const zip = new AdmZip(); const zip = new AdmZip();
files.forEach(file => { files.forEach(file => {
const filename = file.replace(process.env.GITHUB_WORKSPACE, ""); const filename = file.replace(`${process.env.GITHUB_WORKSPACE}/`, "");
if (!fs.existsSync(filename)) { if (!fs.existsSync(file)) {
console.log(` - ${filename} (Not Found)`); console.log(` - ${filename} (Not Found)`);
return; return;
} }
const dir = path.dirname(filename); const dir = path.dirname(filename);
const stats = fs.lstatSync(filename); const stats = fs.lstatSync(file);
if (stats.isDirectory()) { if (stats.isDirectory()) {
zip.addLocalFolder(filename, dir); zip.addLocalFolder(file, dir);
} else { } else {
zip.addLocalFile(filename, dir === "." ? "" : dir); zip.addLocalFile(file, dir === "." ? "" : dir);
} }
console.log(` - ${filename}`); console.log(` - ${filename}`);

View file

@ -15,20 +15,20 @@ console.log(`Ready to zip "${files}" into ${output}`);
const zip = new AdmZip(); const zip = new AdmZip();
files.forEach(file => { files.forEach(file => {
const filename = file.replace(process.env.GITHUB_WORKSPACE, ""); const filename = file.replace(`${process.env.GITHUB_WORKSPACE}/`, "");
if (!fs.existsSync(filename)) { if (!fs.existsSync(file)) {
console.log(` - ${filename} (Not Found)`); console.log(` - ${filename} (Not Found)`);
return; return;
} }
const dir = path.dirname(filename); const dir = path.dirname(filename);
const stats = fs.lstatSync(filename); const stats = fs.lstatSync(file);
if (stats.isDirectory()) { if (stats.isDirectory()) {
zip.addLocalFolder(filename, dir); zip.addLocalFolder(file, dir);
} else { } else {
zip.addLocalFile(filename, dir === "." ? "" : dir); zip.addLocalFile(file, dir === "." ? "" : dir);
} }
console.log(` - ${filename}`); console.log(` - ${filename}`);