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

Method saveDialog

src/app/ModuleWidget.cpp:720–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718}
719
720void ModuleWidget::saveDialog() {
721 std::string presetDir = model->getUserPresetDirectory();
722 system::createDirectories(presetDir);
723
724 // Delete directories if empty
725 DEFER({
726 try {
727 system::remove(presetDir);
728 system::remove(system::getDirectory(presetDir));
729 }
730 catch (Exception& e) {
731 // Ignore exceptions if directory cannot be removed.
732 }
733 });
734
735 osdialog_filters* filters = osdialog_filters_parse(PRESET_FILTERS);
736 DEFER({osdialog_filters_free(filters);});
737
738 char* pathC = osdialog_file(OSDIALOG_SAVE, presetDir.c_str(), "Untitled.vcvm", filters);
739 if (!pathC) {
740 // No path selected
741 return;
742 }
743 DEFER({std::free(pathC);});
744
745 std::string path = pathC;
746 // Automatically append .vcvm extension
747 if (system::getExtension(path) != ".vcvm")
748 path += ".vcvm";
749
750 save(path);
751}
752
753void ModuleWidget::disconnect() {
754 for (PortWidget* pw : getPorts()) {

Callers 3

onHoverKeyMethod · 0.45
createContextMenuMethod · 0.45
onActionMethod · 0.45

Calls 6

createDirectoriesFunction · 0.85
removeFunction · 0.85
getDirectoryFunction · 0.85
getExtensionFunction · 0.85
saveFunction · 0.85

Tested by

no test coverage detected