Skip to content

Commit

Permalink
🐛 CLI: Add windows support to import:credentials --separate
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Jun 27, 2022
1 parent 86721fc commit e0bdabb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/cli/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { LoggerProxy } from 'n8n-workflow';

import fs from 'fs';
import glob from 'fast-glob';
import path from 'path';
import { EntityManager, getConnection } from 'typeorm';
import { getLogger } from '../../src/Logger';
import { Db } from '../../src';
Expand Down Expand Up @@ -87,9 +86,15 @@ export class ImportCredentialsCommand extends Command {
const encryptionKey = await UserSettings.getEncryptionKey();

if (flags.separate) {
const files = await glob(
`${flags.input.endsWith(path.sep) ? flags.input : flags.input + path.sep}*.json`,
);
let { input: inputPath } = flags;

if (process.platform === 'win32') {
inputPath = inputPath.replace(/\\/g, '/');
}

inputPath = inputPath.replace(/\/$/g, '');

const files = await glob(`${inputPath}/*.json`);

totalImported = files.length;

Expand Down

0 comments on commit e0bdabb

Please sign in to comment.