jatinchowdhury18 / ChowDSP-VCV

ChowDSP modules for VCV Rack
GNU General Public License v3.0
81 stars 8 forks source link

Refactor FileUtils to fix delete/free inconsistency, and support async file dialogs #30

Closed jatinchowdhury18 closed 2 years ago

jatinchowdhury18 commented 2 years ago

Related to the changes discussed in #28.

This patch should probably be tested with Cardinal before merging (@falkTX).

falkTX commented 2 years ago

Just tested this. While it works, there is a C++14 feature in place. Since Rack uses C++11, not sure you want that.

ChowDSP/src/Credit/FileUtils.hpp: In function 'void file_utils::saveToChosenFilePath(std::function<void(const char*)>&&)':
ChowDSP/src/Credit/FileUtils.hpp:45:70: warning: lambda capture initializers only available with '-std=c++14' or '-std=gnu++14'
   45 |     async_dialog_filebrowser(true, dir.c_str(), "Save credit file", [action = std::move (saveAction)](char* path) {
      | 
jatinchowdhury18 commented 2 years ago

Yeah, that's a good point. I've updated the async call now to use std::bind instead of the lambda capture initializer. It's a little uglier, but I believe that's the only C++11-friendly way to move something into a lambda that will be called asynchronously.