diff --git a/packages/chatdown/src/commands/chatdown/convert.ts b/packages/chatdown/src/commands/chatdown/convert.ts index 393db5814..8d585f4c0 100644 --- a/packages/chatdown/src/commands/chatdown/convert.ts +++ b/packages/chatdown/src/commands/chatdown/convert.ts @@ -153,7 +153,7 @@ export default class ChatdownConvert extends Command { let validatedPath = utils.validatePath(writeFile, '', force) await fs.ensureFile(writeFile) await fs.writeJson(validatedPath, activities, {spaces: 2}) - return writeFile + return validatedPath } const output = JSON.stringify(activities, null, 2) await new Promise(done => process.stdout.write(output, 'utf-8', () => done())) diff --git a/packages/config/src/commands/config/index.ts b/packages/config/src/commands/config/index.ts index 6029080fc..86ec15f6b 100644 --- a/packages/config/src/commands/config/index.ts +++ b/packages/config/src/commands/config/index.ts @@ -4,7 +4,7 @@ */ import {Command, flags} from '@oclif/command' - +const path = require('path') export default class ConfigIndex extends Command { static description = 'Configure various settings within the cli.' @@ -13,7 +13,7 @@ export default class ConfigIndex extends Command { } async run() { - this.log(`\nConfig file location: ' ${this.config.configDir}/config.json \n `) + this.log(`\nConfig file location: ' ${path.join(this.config.configDir, 'config.json')} \n `) this._help() } } diff --git a/packages/lu/src/commands/luis/convert.ts b/packages/lu/src/commands/luis/convert.ts index b11e78a0e..a019553c4 100644 --- a/packages/lu/src/commands/luis/convert.ts +++ b/packages/lu/src/commands/luis/convert.ts @@ -81,13 +81,13 @@ export default class LuisConvert extends Command { private async writeOutput(convertedObject: any, flags: any, isLu: boolean) { let filePath = await file.generateNewFilePath(flags.out, flags.in, isLu) + const validatedPath = utils.validatePath(filePath, '', flags.force) // write out the final file try { - const validatedPath = utils.validatePath(filePath, '', flags.force) await fs.writeFile(validatedPath, convertedObject, 'utf-8') } catch (err) { - throw new CLIError('Unable to write file - ' + filePath + ' Error: ' + err.message) + throw new CLIError('Unable to write file - ' + validatedPath + ' Error: ' + err.message) } - this.log('Successfully wrote LUIS model to ' + filePath) + this.log('Successfully wrote LUIS model to ' + validatedPath) } } diff --git a/packages/lu/src/commands/qnamaker/convert.ts b/packages/lu/src/commands/qnamaker/convert.ts index 38ad8fc69..13689c2e2 100644 --- a/packages/lu/src/commands/qnamaker/convert.ts +++ b/packages/lu/src/commands/qnamaker/convert.ts @@ -78,21 +78,21 @@ export default class QnamakerConvert extends Command { private async writeOutput(convertedObject: any, flags: any, isQnA: boolean) { let filePath = await file.generateNewFilePath(flags.out, flags.in, isQnA, '', fileExtEnum.QnAFile) + const validatedPath = utils.validatePath(filePath, '', flags.force) try { if (isQnA) { - let validatedPath = utils.validatePath(filePath, '', flags.force) await fs.writeFile(validatedPath, JSON.stringify(convertedObject.finalQnAJSON, null, 2), 'utf-8') if (convertedObject.finalQnAAlterations) { let filePathAlterations = await file.generateNewFilePath(flags.out, flags.in, isQnA, 'alterations_', fileExtEnum.QnAFile) - let validatedPath = utils.validatePath(filePathAlterations, '', flags.force) - await fs.writeFile(validatedPath, JSON.stringify(convertedObject.finalQnAAlterations, null, 2), 'utf-8') + const validatedPathAlter = utils.validatePath(filePathAlterations, '', flags.force) + await fs.writeFile(validatedPathAlter, JSON.stringify(convertedObject.finalQnAAlterations, null, 2), 'utf-8') } } else { - await fs.writeFile(filePath, convertedObject, 'utf-8') + await fs.writeFile(validatedPath, convertedObject, 'utf-8') } } catch (err) { - throw new CLIError('Unable to write file - ' + filePath + ' Error: ' + err.message) + throw new CLIError('Unable to write file - ' + validatedPath + ' Error: ' + err.message) } - this.log('Successfully wrote QnA model to ' + filePath) + this.log('Successfully wrote QnA model to ' + validatedPath) } }