🐛 CLI: Add windows support to import:workflow --separate (#2441)

This commit is contained in:
Tom 2021-11-19 18:16:00 +01:00 committed by GitHub
parent f2c8027e25
commit d22a4b1b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,9 +86,12 @@ export class ImportWorkflowsCommand extends Command {
const credentialsEntities = (await Db.collections.Credentials?.find()) ?? [];
let i;
if (flags.separate) {
const files = await glob(
`${flags.input.endsWith(path.sep) ? flags.input : flags.input + path.sep}*.json`,
);
let inputPath = flags.input;
if (process.platform === 'win32') {
inputPath = inputPath.replace(/\\/g, '/');
}
inputPath = inputPath.replace(/\/$/g, '');
const files = await glob(`${inputPath}/*.json`);
for (i = 0; i < files.length; i++) {
const workflow = JSON.parse(fs.readFileSync(files[i], { encoding: 'utf8' }));
if (credentialsEntities.length > 0) {