diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 11:08:11 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-08-10 11:52:31 +0200 |
commit | 85216966fa6d0e031ed545cf2cee4507a624b679 (patch) | |
tree | 68acccda3016de5d9b8d22e8261c1961a818b773 | |
parent | 1c823e9d1f52ae54677bae884b1f5995292869f3 (diff) | |
download | mpd-85216966fa6d0e031ed545cf2cee4507a624b679.tar.gz mpd-85216966fa6d0e031ed545cf2cee4507a624b679.tar.xz mpd-85216966fa6d0e031ed545cf2cee4507a624b679.zip |
decoder/wildmidi: use class Path for the "timidity.cfg" location
Diffstat (limited to '')
-rw-r--r-- | src/decoder/WildmidiDecoderPlugin.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/decoder/WildmidiDecoderPlugin.cxx b/src/decoder/WildmidiDecoderPlugin.cxx index 1358c20d3..c7bd3985e 100644 --- a/src/decoder/WildmidiDecoderPlugin.cxx +++ b/src/decoder/WildmidiDecoderPlugin.cxx @@ -21,7 +21,9 @@ #include "WildmidiDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "TagHandler.hxx" -#include "glib_compat.h" +#include "fs/Path.hxx" +#include "fs/FileSystem.hxx" +#include "system/FatalError.hxx" #include <glib.h> @@ -37,18 +39,20 @@ static constexpr unsigned WILDMIDI_SAMPLE_RATE = 48000; static bool wildmidi_init(const config_param ¶m) { - const char *config_file; - int ret; - - config_file = param.GetBlockValue("config_file", - "/etc/timidity/timidity.cfg"); - if (!g_file_test(config_file, G_FILE_TEST_IS_REGULAR)) { - g_debug("configuration file does not exist: %s", config_file); + GError *error = nullptr; + const Path path = param.GetBlockPath("config_file", + "/etc/timidity/timidity.cfg", + &error); + if (path.IsNull()) + FatalError(error); + + if (!FileExists(path)) { + const auto utf8 = path.ToUTF8(); + g_debug("configuration file does not exist: %s", utf8.c_str()); return false; } - ret = WildMidi_Init(config_file, WILDMIDI_SAMPLE_RATE, 0); - return ret == 0; + return WildMidi_Init(path.c_str(), WILDMIDI_SAMPLE_RATE, 0) == 0; } static void |