Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 8ca578e

Browse files
authored
Fixing output file path messages (#296)
1 parent a67721b commit 8ca578e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

packages/chatdown/src/commands/chatdown/convert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export default class ChatdownConvert extends Command {
153153
let validatedPath = utils.validatePath(writeFile, '', force)
154154
await fs.ensureFile(writeFile)
155155
await fs.writeJson(validatedPath, activities, {spaces: 2})
156-
return writeFile
156+
return validatedPath
157157
}
158158
const output = JSON.stringify(activities, null, 2)
159159
await new Promise(done => process.stdout.write(output, 'utf-8', () => done()))

packages/config/src/commands/config/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import {Command, flags} from '@oclif/command'
7-
7+
const path = require('path')
88
export default class ConfigIndex extends Command {
99
static description = 'Configure various settings within the cli.'
1010

@@ -13,7 +13,7 @@ export default class ConfigIndex extends Command {
1313
}
1414

1515
async run() {
16-
this.log(`\nConfig file location: ' ${this.config.configDir}/config.json \n `)
16+
this.log(`\nConfig file location: ' ${path.join(this.config.configDir, 'config.json')} \n `)
1717
this._help()
1818
}
1919
}

packages/lu/src/commands/luis/convert.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ export default class LuisConvert extends Command {
8181

8282
private async writeOutput(convertedObject: any, flags: any, isLu: boolean) {
8383
let filePath = await file.generateNewFilePath(flags.out, flags.in, isLu)
84+
const validatedPath = utils.validatePath(filePath, '', flags.force)
8485
// write out the final file
8586
try {
86-
const validatedPath = utils.validatePath(filePath, '', flags.force)
8787
await fs.writeFile(validatedPath, convertedObject, 'utf-8')
8888
} catch (err) {
89-
throw new CLIError('Unable to write file - ' + filePath + ' Error: ' + err.message)
89+
throw new CLIError('Unable to write file - ' + validatedPath + ' Error: ' + err.message)
9090
}
91-
this.log('Successfully wrote LUIS model to ' + filePath)
91+
this.log('Successfully wrote LUIS model to ' + validatedPath)
9292
}
9393
}

packages/lu/src/commands/qnamaker/convert.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,21 @@ export default class QnamakerConvert extends Command {
7878

7979
private async writeOutput(convertedObject: any, flags: any, isQnA: boolean) {
8080
let filePath = await file.generateNewFilePath(flags.out, flags.in, isQnA, '', fileExtEnum.QnAFile)
81+
const validatedPath = utils.validatePath(filePath, '', flags.force)
8182
try {
8283
if (isQnA) {
83-
let validatedPath = utils.validatePath(filePath, '', flags.force)
8484
await fs.writeFile(validatedPath, JSON.stringify(convertedObject.finalQnAJSON, null, 2), 'utf-8')
8585
if (convertedObject.finalQnAAlterations) {
8686
let filePathAlterations = await file.generateNewFilePath(flags.out, flags.in, isQnA, 'alterations_', fileExtEnum.QnAFile)
87-
let validatedPath = utils.validatePath(filePathAlterations, '', flags.force)
88-
await fs.writeFile(validatedPath, JSON.stringify(convertedObject.finalQnAAlterations, null, 2), 'utf-8')
87+
const validatedPathAlter = utils.validatePath(filePathAlterations, '', flags.force)
88+
await fs.writeFile(validatedPathAlter, JSON.stringify(convertedObject.finalQnAAlterations, null, 2), 'utf-8')
8989
}
9090
} else {
91-
await fs.writeFile(filePath, convertedObject, 'utf-8')
91+
await fs.writeFile(validatedPath, convertedObject, 'utf-8')
9292
}
9393
} catch (err) {
94-
throw new CLIError('Unable to write file - ' + filePath + ' Error: ' + err.message)
94+
throw new CLIError('Unable to write file - ' + validatedPath + ' Error: ' + err.message)
9595
}
96-
this.log('Successfully wrote QnA model to ' + filePath)
96+
this.log('Successfully wrote QnA model to ' + validatedPath)
9797
}
9898
}

0 commit comments

Comments
 (0)