From 515f5d940e2b444184be450888c49e7c5f3a0f46 Mon Sep 17 00:00:00 2001 From: Xmader Date: Thu, 26 Nov 2020 15:07:34 -0500 Subject: [PATCH] refactor(cli): file destination --- src/cli.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index c1fa783..da345fa 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -3,6 +3,7 @@ /* eslint-disable no-void */ import fs from 'fs' +import path from 'path' import { fetchMscz, MSCZ_URL_SYM } from './mscz' import { loadMscore, INDV_DOWNLOADS, WebMscore } from './mscore' import { ScoreInfoHtml } from './scoreinfo' @@ -120,15 +121,14 @@ void (async () => { }, default: process.cwd(), }) - // change working directory - process.chdir(dest) // export files spinner.start() await Promise.all( filetypes.map(async (d) => { const data = await d.action(score) - const f = `${fileName} - ${escapeFilename(partName)}.${d.fileExt}` + const n = `${fileName} - ${escapeFilename(partName)}.${d.fileExt}` + const f = path.join(dest, n) await fs.promises.writeFile(f, data) spinner.info(`Saved ${chalk.underline(f)}`) spinner.start()