MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / doOpenFileCallback

Method doOpenFileCallback

tools/xsbug/main.js:391–413  ·  view source on GitHub ↗
(application, path)

Source from the content-addressed store, hash-verified

389 system.openFile({ prompt:"Open File" }, path => { if (path) application.defer("doOpenFileCallback", new String(path)); });
390 }
391 doOpenFileCallback(application, path) {
392 if (path.endsWith(".js") || path.endsWith(".json") || path.endsWith(".ts") || path.endsWith(".xml") || path.endsWith(".xs"))
393 this.selectFile(path);
394 else if (path.endsWith(".bin")) {
395 this.showTab(3, true);
396 this.selectMachine(null, 3);
397 this.serial.doInstallApp(path);
398 }
399 else if (path.endsWith(".xsa")) {
400 this.showTab(3, true);
401 this.selectMachine(null, 3);
402 this.serial.doInstallMod(path);
403 }
404 else if (path.endsWith(".cpuprofile")) {
405 this.showTab(2, true);
406 this.selectMachine(null, 2);
407 path = path.valueOf();
408 let profile = this.profiles.find(profile => profile.path == path);
409 if (!profile) {
410 this.doOpenProfile(path);
411 }
412 }
413 }
414 doOpenProfile(path) {
415 let profile;
416 try {

Callers 1

onOpenFileMethod · 0.95

Calls 5

selectFileMethod · 0.95
showTabMethod · 0.95
selectMachineMethod · 0.95
doOpenProfileMethod · 0.95
findMethod · 0.80

Tested by

no test coverage detected