MCPcopy Create free account
hub / github.com/VCVRack/Rack / loadDialog

Method loadDialog

src/patch.cpp:400–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398
399
400void Manager::loadDialog() {
401 if (!promptClear(string::translate("patch.loadConfirm")))
402 return;
403
404 std::string dir;
405 if (this->path != "") {
406 dir = system::getDirectory(this->path);
407 }
408
409 // Use fallback lastPatchDirectory
410 if (dir == "" || !system::isDirectory(dir)) {
411 dir = settings::lastPatchDirectory;
412
413 // Use fallback <Rack user dir>/patches
414 if (dir == "" || !system::isDirectory(dir)) {
415 dir = asset::user("patches");
416 system::createDirectory(dir);
417 }
418 }
419
420 osdialog_filters* filters = osdialog_filters_parse(PATCH_FILTERS);
421 DEFER({osdialog_filters_free(filters);});
422
423 char* pathC = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, filters);
424 if (!pathC) {
425 // Cancel silently
426 return;
427 }
428 std::string path = pathC;
429 std::free(pathC);
430
431 loadAction(path);
432}
433
434
435void Manager::loadPathDialog(std::string path) {

Callers

nothing calls this directly

Calls 6

promptClearFunction · 0.85
translateFunction · 0.85
getDirectoryFunction · 0.85
isDirectoryFunction · 0.85
userFunction · 0.85
createDirectoryFunction · 0.85

Tested by

no test coverage detected