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
This commit is contained in:
parent
c4d3efe71d
commit
0abaa3ecc5
@ -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)
|
|||||||
|
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user