Skip to content

Commit

Permalink
Fix opening challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTarados committed Oct 31, 2023
1 parent f130521 commit 4c6a514
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/render_logic/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,14 @@ function unblock_buttons(){
pause_button.disabled = false;
}

const ff = require('node-find-folder');
var ff_result = new ff('challenges');
console.log(ff_result)
function switch_to_challenge_mode(file){
//open json
let json;
try{
json = JSON.parse(fs.readFileSync('./challenges/'+file));
json = JSON.parse(fs.readFileSync(ff_result[0]+"/"+file));
}catch{
dialog.showErrorBox("Error", "Can't open challenge file, either it doesn't exist or it's not a valid json file.");
throw "Can't open challenge file";
Expand Down

0 comments on commit 4c6a514

Please sign in to comment.