From a77ec1c880c6e48918cfe5c7d05c3373a2e72915 Mon Sep 17 00:00:00 2001 From: papeloto Date: Sat, 21 Mar 2020 13:11:41 +0100 Subject: [PATCH] fix: missing forward slash --- dist/index.js | 10 +++++----- index.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 30fc78b..7c20b7d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -70,20 +70,20 @@ console.log(`Ready to zip "${files}" into ${output}`); const zip = new AdmZip(); 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)`); return; } const dir = path.dirname(filename); - const stats = fs.lstatSync(filename); + const stats = fs.lstatSync(file); if (stats.isDirectory()) { - zip.addLocalFolder(filename, dir); + zip.addLocalFolder(file, dir); } else { - zip.addLocalFile(filename, dir === "." ? "" : dir); + zip.addLocalFile(file, dir === "." ? "" : dir); } console.log(` - ${filename}`); diff --git a/index.js b/index.js index 4ced02c..7828864 100644 --- a/index.js +++ b/index.js @@ -15,20 +15,20 @@ console.log(`Ready to zip "${files}" into ${output}`); const zip = new AdmZip(); 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)`); return; } const dir = path.dirname(filename); - const stats = fs.lstatSync(filename); + const stats = fs.lstatSync(file); if (stats.isDirectory()) { - zip.addLocalFolder(filename, dir); + zip.addLocalFolder(file, dir); } else { - zip.addLocalFile(filename, dir === "." ? "" : dir); + zip.addLocalFile(file, dir === "." ? "" : dir); } console.log(` - ${filename}`);