diff --git a/dep/Makefile b/dep/Makefile index 53e61f8d..a2adafa7 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -146,17 +146,17 @@ $(rtaudio): # For some reason, it doesn't install the static library cp rtaudio/build/librtaudio_static.a lib/librtaudio.a -$(nanovg): - cp nanovg/src/*.h include/ +$(nanovg): $(wildcard nanovg/src/*.h) + cp $^ include/ -$(nanosvg): - cp nanosvg/src/*.h include/ +$(nanosvg): $(wildcard nanosvg/src/*.h) + cp $^ include/ -$(oui-blendish): - cp oui-blendish/*.h include/ +$(oui-blendish): $(wildcard blendish/*.h) + cp $^ include/ -$(osdialog): - cp osdialog/*.h include/ +$(osdialog): $(wildcard osdialog/*.h) + cp $^ include/ clean: git clean -fdx diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index ba02a202..980f2b2b 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -12,6 +12,9 @@ namespace rack { +static const char *FILTERS = "VCV Rack patch (.vcv):*.vcv"; + + struct ModuleContainer : Widget { void draw(NVGcontext *vg) override { // Draw shadows behind each ModuleWidget first, so the shadow doesn't overlap the front. @@ -77,12 +80,14 @@ void RackWidget::openDialog() { else { dir = stringDirectory(lastPath); } - char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, NULL); + osdialog_filters *filters = osdialog_filters_parse(FILTERS); + char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, filters); if (path) { loadPatch(path); lastPath = path; free(path); } + osdialog_filters_free(filters); } void RackWidget::saveDialog() { @@ -96,14 +101,17 @@ void RackWidget::saveDialog() { void RackWidget::saveAsDialog() { std::string dir; + std::string filename; if (lastPath.empty()) { dir = assetLocal("patches"); systemCreateDirectory(dir); } else { dir = stringDirectory(lastPath); + filename = stringFilename(lastPath); } - char *path = osdialog_file(OSDIALOG_SAVE, dir.c_str(), "Untitled.vcv", NULL); + osdialog_filters *filters = osdialog_filters_parse(FILTERS); + char *path = osdialog_file(OSDIALOG_SAVE, dir.c_str(), filename.c_str(), filters); if (path) { std::string pathStr = path; @@ -116,6 +124,7 @@ void RackWidget::saveAsDialog() { savePatch(pathStr); lastPath = pathStr; } + osdialog_filters_free(filters); } void RackWidget::savePatch(std::string path) {