Skip to content
Open
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
6 changes: 4 additions & 2 deletions console/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ let midiInput = new midi.Input();
/**
* Reads the config file and returns the JSON inside
*/
async function readConfig(defaultConfig) {
async function readConfig(readConfig, defaultConfig) {
// Check for existing config file
if (!fs.existsSync(configPath)) {
console.warn("No config.json file found, creating default at " + configPath);
try {
fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 4));
return defaultConfig;

const configJson = fs.readFileSync(configPath, { encoding: 'utf8', flag: 'r' });
return configJson;
}
catch (e) {
console.error("Failed to write default config file " + configPath + "!");
Expand Down