Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ export default class Config {
fs.writeFileSync(Config.configFilePath(), JSON.stringify(config));
}

static resetConfig() {
const configPath = Config.configFilePath();
if (!fs.existsSync(configPath)) {
return;
}

let backupPath = `${configPath}.bak`;
let index = 1;
while (fs.existsSync(backupPath)) {
backupPath = `${configPath}.bak${index}`;
index += 1;
}

fs.renameSync(configPath, backupPath);
}

static getRyuPath() {
const config = Config.readFile();
return config.ryuPath;
Expand Down
12 changes: 10 additions & 2 deletions src/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BrowserWindow,
MenuItemConstructorOptions,
} from 'electron';
import Config from './config';

interface DarwinMenuItemConstructorOptions extends MenuItemConstructorOptions {
selector?: string;
Expand Down Expand Up @@ -198,8 +199,15 @@ export default class MenuBuilder {
label: '&File',
submenu: [
{
label: '&Open',
accelerator: 'Ctrl+O',
label: '&Reset Launcher Config',
click: () => {
Config.resetConfig();
app.relaunch();
app.quit();
},
},
{
type: 'separator',
},
{
label: '&Close',
Expand Down
Loading