config/Global: _get_path() throws exception on error

This commit is contained in:
Max Kellermann
2016-11-02 10:01:29 +01:00
parent 5a63d1d5a4
commit d765182bbb
4 changed files with 25 additions and 60 deletions

View File

@@ -26,7 +26,6 @@
#include "fs/StandardDirectory.hxx"
#include "fs/CheckFile.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/RuntimeError.hxx"
#include <assert.h>
@@ -44,14 +43,9 @@ CreateConfiguredStorageUri(EventLoop &event_loop, const char *uri)
static AllocatedPath
GetConfiguredMusicDirectory()
{
Error error;
AllocatedPath path = config_get_path(ConfigOption::MUSIC_DIR, error);
if (path.IsNull()) {
if (error.IsDefined())
throw std::runtime_error(error.GetMessage());
AllocatedPath path = config_get_path(ConfigOption::MUSIC_DIR);
if (path.IsNull())
path = GetUserMusicDir();
}
return path;
}