From d91ca6373aa51dfd5b8cc20d282f2b2805eedd22 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Sat, 15 Feb 2020 15:57:40 +0800 Subject: [PATCH] improve feedback --- src/renderer.jsx | 3 ++- src/util.js | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/renderer.jsx b/src/renderer.jsx index 23d73fe8..cdd96b96 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -30,7 +30,7 @@ const ffmpeg = require('./ffmpeg'); const { getOutPath, parseDuration, formatDuration, toast, errorToast, showFfmpegFail, setFileNameTitle, - promptTimeOffset, generateColor, + promptTimeOffset, generateColor, getOutDir, } = require('./util'); const { dialog } = electron.remote; @@ -417,6 +417,7 @@ const App = memo(() => { showFfmpegFail(err); } finally { + toast.fire({ timer: 10000, type: 'success', title: `Cut completed! Output file(s) can be found at: ${getOutDir(customOutDir, filePath)}. You can change the output directory in settings` }); setWorking(false); } }, [ diff --git a/src/util.js b/src/util.js index 23a21a4b..8a587578 100644 --- a/src/util.js +++ b/src/util.js @@ -36,12 +36,15 @@ function parseDuration(str) { return ((((hours * 60) + minutes) * 60) + seconds) + (ms / 1000); } +function getOutDir(customOutDir, filePath) { + const dirname = path.dirname(filePath); + return customOutDir || dirname; +} + function getOutPath(customOutDir, filePath, nameSuffix) { const basename = path.basename(filePath); - return customOutDir - ? path.join(customOutDir, `${basename}-${nameSuffix}`) - : `${filePath}-${nameSuffix}`; + return path.join(getOutDir(customOutDir, filePath), `${basename}-${nameSuffix}`); } async function transferTimestamps(inPath, outPath) { @@ -114,6 +117,7 @@ module.exports = { formatDuration, parseDuration, getOutPath, + getOutDir, transferTimestamps, transferTimestampsWithOffset, toast,