clone45 / voxglitch

Modules for VCV Rack
GNU General Public License v3.0
100 stars 16 forks source link

Groovebox file selection does not work on GNU/Linux #141

Closed cschol closed 2 years ago

cschol commented 2 years ago

Groovebox file selection does not work on GNU/Linux. No wav files appear in the dialog even though files are present in the folder.

The osdialog filter syntax does not appear to be correct: "WAV:wav:Wav". It should be "WAV:wav" like in all other cases in the plugin.

NOTE: I think another problem is that osdialog_filters_parse allocates memory that is never freed in your current implementation. You should be storing a pointer and calling osdialog_filters_free when you are done with the filters. Most (if not all) other modules do that.

The following code works correctly:

diff --git a/src/GrooveBox/GrooveBoxWidget.hpp b/src/GrooveBox/GrooveBoxWidget.hpp
index 0c5ce04..a5b7f47 100644
--- a/src/GrooveBox/GrooveBoxWidget.hpp
+++ b/src/GrooveBox/GrooveBoxWidget.hpp
@@ -173,7 +173,9 @@ struct TrackLabelDisplay : TransparentWidget
                        pathSelected(module, track_number, path);
                });
 #else
-               char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, osdialog_filters_parse("WAV:wav:Wav"));
+        osdialog_filters* filters = osdialog_filters_parse("WAV:wav");
+               char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, filters);^M
+        osdialog_filters_free(filters);
                pathSelected(module, track_number, path);
 #endif
        }
@@ -335,7 +337,9 @@ struct LoadSampleMenuItem : MenuItem
                        pathSelected(module, track_number, path);
                });
 #else
-               char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, osdialog_filters_parse("WAV:wav:Wav"));
+        osdialog_filters* filters = osdialog_filters_parse("WAV:wav");
+               char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, filters);
+        osdialog_filters_free(filters);
                pathSelected(module, track_number, path);
 #endif
clone45 commented 2 years ago

Ok, I'll get this fixed asap. Thanks for taking the time to report this bug!

cschol commented 2 years ago

Of course. Love your modules!

cschol commented 2 years ago

One more comment: Rack uses zenity as the framework for crossplatform dialogs. The current implementation of osdialog does not support multiple patterns for filters (see here). I was confused why wav:wav,Wav,WAV didn't work and only wav files were selectable.

clone45 commented 2 years ago

Fixed in upcoming 2.14.1 :-)

cschol commented 2 years ago

Fix confirmed. Integrating now.