Commit 0abaa3ec authored by Max Kellermann's avatar Max Kellermann

decoder/wildmidi: throw PluginUnavailable if config file does not exist

This makes the configuration error more visible, possibly addressing one part of https://github.com/MusicPlayerDaemon/MPD/issues/589
parent c4d3efe7
...@@ -21,10 +21,12 @@ ...@@ -21,10 +21,12 @@
#include "../DecoderAPI.hxx" #include "../DecoderAPI.hxx"
#include "tag/Handler.hxx" #include "tag/Handler.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/StringFormat.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx" #include "fs/FileSystem.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "PluginUnavailable.hxx"
extern "C" { extern "C" {
#include <wildmidi_lib.h> #include <wildmidi_lib.h>
...@@ -43,10 +45,8 @@ wildmidi_init(const ConfigBlock &block) ...@@ -43,10 +45,8 @@ wildmidi_init(const ConfigBlock &block)
if (!FileExists(path)) { if (!FileExists(path)) {
const auto utf8 = path.ToUTF8(); const auto utf8 = path.ToUTF8();
FormatDebug(wildmidi_domain, throw PluginUnavailable(StringFormat<1024>("configuration file does not exist: %s",
"configuration file does not exist: %s", utf8.c_str()));
utf8.c_str());
return false;
} }
return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment