From d22a4b1b11e936c56d1d669bb4b3f43736274c6c Mon Sep 17 00:00:00 2001 From: Tom <19203795+that-one-tom@users.noreply.github.com> Date: Fri, 19 Nov 2021 18:16:00 +0100 Subject: [PATCH] :bug: CLI: Add windows support to import:workflow --separate (#2441) --- packages/cli/commands/import/workflow.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cli/commands/import/workflow.ts b/packages/cli/commands/import/workflow.ts index e27ac2dd16..e2b51d26f9 100644 --- a/packages/cli/commands/import/workflow.ts +++ b/packages/cli/commands/import/workflow.ts @@ -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) {