diff --git a/gui/electron/src/index.ts b/gui/electron/src/index.ts index 069adeb..f5e9432 100644 --- a/gui/electron/src/index.ts +++ b/gui/electron/src/index.ts @@ -5,7 +5,7 @@ import dotenv from 'dotenv'; import express from 'express'; import { Console } from 'console'; import json from '../../../package.json'; - +import { ensureConfig } from '../../../modules/module.cfg-loader'; process.on('uncaughtException', (er, or) => { console.error(er, or); @@ -50,7 +50,7 @@ if (!fs.existsSync(getDataDirectory())) export { getDataDirectory }; process.env.contentDirectory = getDataDirectory(); - +ensureConfig(); import './menu'; diff --git a/gui/electron/src/menu.ts b/gui/electron/src/menu.ts index ca3959b..0aa86fe 100644 --- a/gui/electron/src/menu.ts +++ b/gui/electron/src/menu.ts @@ -44,6 +44,41 @@ const template: (MenuItemConstructorOptions | MenuItem)[] = [ } ] }, + { + label: 'Settings', + submenu: [ + { + label: 'Open settings folder', + click: () => { + shell.openPath(path.join(getDataDirectory(), 'config')) + } + }, + { + label: 'Open settings file...', + submenu: [ + { + label: 'FFmpeg/Mkvmerge path', + click: () => { + shell.openPath(path.join(getDataDirectory(), 'config', 'bin-path.yml')) + } + }, + { + label: 'Advanced options', + sublabel: 'See the documention for the options you may enter here', + click: () => { + shell.openPath(path.join(getDataDirectory(), 'config', 'cli-defaults.yml')) + } + }, + { + label: 'Output path', + click: () => { + shell.openPath(path.join(getDataDirectory(), 'config', 'dir-path.yml')) + } + } + ] + } + ] + }, { label: 'Help', submenu: [ diff --git a/modules/module.cfg-loader.ts b/modules/module.cfg-loader.ts index f778199..f9b8ae0 100644 --- a/modules/module.cfg-loader.ts +++ b/modules/module.cfg-loader.ts @@ -19,6 +19,14 @@ const tokenFile = { cr: path.join(workingDir, 'config', 'cr_token') }; +export const ensureConfig = () => { + if (process.env.contentDirectory) + [binCfgFile, dirCfgFile, cliCfgFile].forEach(a => { + if (!fs.existsSync(`${a}.yml`)) + fs.copyFileSync(path.join('config', `${path.basename(a)}.yml`), `${a}.yml`); + }) +} + const loadYamlCfgFile = >(file: string, isSess?: boolean): T => { if(fs.existsSync(`${file}.user.yml`) && !isSess){ file += '.user';