Added #286
This commit is contained in:
parent
431e840913
commit
9a805f995a
3 changed files with 45 additions and 2 deletions
|
|
@ -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';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -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 = <T extends Record<string, any>>(file: string, isSess?: boolean): T => {
|
||||
if(fs.existsSync(`${file}.user.yml`) && !isSess){
|
||||
file += '.user';
|
||||
|
|
|
|||
Loading…
Reference in a new issue