Thanks for your investigations! I also assumed they were optional but in this particular code path it throws an exception if the file isn’t there in ModuleWidget::load() (see code snippet).
My understanding is the exception should be ignored because the calling function ModuleWidget::loadTemplate() ignores the exception.
It’s possible I’ve done something to screw up my environment, I don’t remember getting this before, now I get it when trying to load the in-built modules and my own.
void ModuleWidget::load(std::string filename) {
FILE* file = std::fopen(filename.c_str(), "r");
if (!file)
throw Exception("Could not load patch file %s", filename.c_str());
DEFER({std::fclose(file);});
INFO("Loading preset %s", filename.c_str());
json_error_t error;
json_t* moduleJ = json_loadf(file, 0, &error);
if (!moduleJ)
throw Exception("File is not a valid patch file. JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text);
DEFER({json_decref(moduleJ);});
engine::Module::jsonStripIds(moduleJ);
fromJson(moduleJ);
}
Here’s a stack trace
__cxa_throw (@__cxa_throw:3)
rack::app::ModuleWidget::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) (/Users/x/Code/Github/Rack/src/app/ModuleWidget.cpp:583)
rack::app::ModuleWidget::loadTemplate() (/Users/x/Code/Github/Rack/src/app/ModuleWidget.cpp:621)
rack::app::browser::chooseModel(rack::plugin::Model*) (/Users/x/Code/Github/Rack/src/app/Browser.cpp:100)
rack::app::browser::ModelBox::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/src/app/Browser.cpp:261)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
rack::ui::ScrollWidget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/src/ui/ScrollWidget.cpp:130)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
rack::app::browser::Browser::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/src/app/Browser.cpp:791)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
rack::widget::OpaqueWidget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/OpaqueWidget.hpp:21)
rack::ui::MenuOverlay::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/src/ui/MenuOverlay.cpp:34)
void rack::widget::Widget::recursePositionEvent<void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent>(void (rack::widget::Widget::*)(rack::widget::Widget::ButtonEvent const&), rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:209)
rack::widget::Widget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/Widget.hpp:246)
rack::widget::OpaqueWidget::onButton(rack::widget::Widget::ButtonEvent const&) (/Users/x/Code/Github/Rack/include/widget/OpaqueWidget.hpp:21)
rack::widget::EventState::handleButton(rack::math::Vec, int, int, int) (/Users/x/Code/Github/Rack/src/widget/event.cpp:134)
-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] (@-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]:871)
-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] (@-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]:94)
-[NSWindow(NSEventRouting) sendEvent:] (@-[NSWindow(NSEventRouting) sendEvent:]:74)
-[NSApplication(NSEventRouting) sendEvent:] (@-[NSApplication(NSEventRouting) sendEvent:]:404)
_glfwPollEventsCocoa (/Users/x/Code/GitHub/Rack/dep/glfw/src/cocoa_window.m:1419)
rack::window::Window::step() (/Users/x/Code/Github/Rack/src/window/Window.cpp:434)
rack::window::Window::run() (/Users/x/Code/Github/Rack/src/window/Window.cpp:412)
main (/Users/x/Code/github/rack/adapters/standalone.cpp:274)
start (@start:593)