commit 34011ceda6873d399a17e63a4f656612325f2ce9
parent 4eceeeb92fb1630f4e110480e95826271c4042d7
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Fri, 25 Oct 2024 14:54:46 +0200
improve "firmware missing" message box, target folder is now automatically opened
Diffstat:
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/source/jucePluginLib/processor.cpp b/source/jucePluginLib/processor.cpp
@@ -28,7 +28,7 @@ namespace pluginLib
{
synthLib::RomLoader::addSearchPath(synthLib::getModulePath(true));
synthLib::RomLoader::addSearchPath(synthLib::getModulePath(false));
- synthLib::RomLoader::addSearchPath(Tools::getPublicDataFolder(getProperties().name) + "roms/");
+ synthLib::RomLoader::addSearchPath(getPublicRomFolder());
}
Processor::~Processor()
@@ -120,19 +120,21 @@ namespace pluginLib
if(e.errorCode() == synthLib::DeviceError::FirmwareMissing)
{
msg += "\n\n";
- msg += "The firmware file needs to be located next to the plugin.";
- msg += "\n\n";
- msg += "The plugin was loaded from path:\n\n";
- msg += synthLib::getModulePath();
+ msg += "The firmware file needs to be copied to\n";
+ msg += getPublicRomFolder() + "\n";
+ msg += "\n";
+ msg += "The target folder is now being opened. Copy the firmware to this folder and reload the plugin.";
#ifdef _DEBUG
- msg += std::string("from host ") + host.toStdString();
+ msg += "\n\n" + std::string("[Debug] Host ") + host.toStdString() + "\n\n";
#endif
- msg += "\n\nCopy the requested file to this path and reload the plugin.";
}
juce::NativeMessageBox::showMessageBoxAsync(juce::AlertWindow::WarningIcon,
"Device Initialization failed", msg, nullptr,
- juce::ModalCallbackFunction::create([](int)
+ juce::ModalCallbackFunction::create([this](int)
{
+ const auto path = juce::File(getPublicRomFolder());
+ (void)path.createDirectory();
+ path.revealToUser();
})
);
}
@@ -333,6 +335,11 @@ namespace pluginLib
return {};
}
+ std::string Processor::getPublicRomFolder() const
+ {
+ return Tools::getPublicDataFolder(getProperties().name) + "roms/";
+ }
+
void Processor::destroyController()
{
m_controller.reset();
diff --git a/source/jucePluginLib/processor.h b/source/jucePluginLib/processor.h
@@ -120,6 +120,9 @@ namespace pluginLib
auto& getMidiPorts() { return m_midiPorts; }
std::optional<std::pair<const char*, uint32_t>> findResource(const std::string& _filename) const;
+
+ std::string getPublicRomFolder() const;
+
protected:
void destroyController();
diff --git a/source/synthLib/deviceException.cpp b/source/synthLib/deviceException.cpp
@@ -10,7 +10,7 @@ namespace synthLib
{
case DeviceError::None: return "No Error, code " + std::to_string(static_cast<int32_t>(_error));
case DeviceError::Unknown: return "Unknown Error, code " + std::to_string(static_cast<int32_t>(_error));
- case DeviceError::FirmwareMissing: return "The firmware file for this device is missing. Copy the firmware next to the plugin and restart it.";
+ case DeviceError::FirmwareMissing: return "The firmware file for this device is missing.";
default:; return "Error code " + std::to_string(static_cast<int32_t>(_error));
}
}