config/Block: GetPath() throws exception on error

This commit is contained in:
Max Kellermann
2016-10-28 23:08:42 +02:00
parent d8bcdca55a
commit e17805f208
8 changed files with 23 additions and 55 deletions

View File

@@ -85,12 +85,9 @@ static bool
sidplay_init(const ConfigBlock &block)
{
/* read the songlengths database file */
Error error;
const auto database_path = block.GetPath("songlength_database", error);
const auto database_path = block.GetPath("songlength_database");
if (!database_path.IsNull())
songlength_database = sidplay_load_songlength_db(database_path);
else if (error.IsDefined())
FatalError(error);
default_songlength = block.GetBlockValue("default_songlength", 0u);

View File

@@ -40,13 +40,9 @@ static constexpr unsigned WILDMIDI_SAMPLE_RATE = 48000;
static bool
wildmidi_init(const ConfigBlock &block)
{
Error error;
const AllocatedPath path =
block.GetPath("config_file",
"/etc/timidity/timidity.cfg",
error);
if (path.IsNull())
FatalError(error);
"/etc/timidity/timidity.cfg");
if (!FileExists(path)) {
const auto utf8 = path.ToUTF8();