diff options
author | Max Kellermann <max@duempel.org> | 2013-10-17 21:59:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-17 23:43:46 +0200 |
commit | abfbd55305587306730d5419b8a3b09e6a43abcb (patch) | |
tree | 2a195220d79efe195f3beacb7dd3a226a3341ad6 /src/Main.cxx | |
parent | b3611524f45c2a478f9decd6d22ecd1dbbbb64b9 (diff) | |
download | mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.gz mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.xz mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.zip |
fs/Path: rename to AllocatedPath
The new class Path only holds a string pointer without being
responsible for allocation/deallocation. The FileSystem.hxx library
accepts Path arguments instead of AllocatedPath, to avoid forcing
callers to allocate another string object.
Diffstat (limited to '')
-rw-r--r-- | src/Main.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index 14820f0db..45d173e78 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -48,7 +48,7 @@ #include "InputInit.hxx" #include "event/Loop.hxx" #include "IOThread.hxx" -#include "fs/Path.hxx" +#include "fs/AllocatedPath.hxx" #include "fs/Config.hxx" #include "PlaylistRegistry.hxx" #include "ZeroconfGlue.hxx" @@ -111,7 +111,7 @@ static StateFile *state_file; static bool glue_daemonize_init(const struct options *options, Error &error) { - Path pid_file = config_get_path(CONF_PID_FILE, error); + auto pid_file = config_get_path(CONF_PID_FILE, error); if (pid_file.IsNull() && error.IsDefined()) return false; @@ -128,17 +128,17 @@ glue_daemonize_init(const struct options *options, Error &error) static bool glue_mapper_init(Error &error) { - Path music_dir = config_get_path(CONF_MUSIC_DIR, error); + auto music_dir = config_get_path(CONF_MUSIC_DIR, error); if (music_dir.IsNull() && error.IsDefined()) return false; - Path playlist_dir = config_get_path(CONF_PLAYLIST_DIR, error); + auto playlist_dir = config_get_path(CONF_PLAYLIST_DIR, error); if (playlist_dir.IsNull() && error.IsDefined()) return false; if (music_dir.IsNull()) { - music_dir = Path::FromUTF8(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC), - error); + music_dir = AllocatedPath::FromUTF8(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC), + error); if (music_dir.IsNull()) return false; } @@ -207,9 +207,12 @@ glue_sticker_init(void) { #ifdef ENABLE_SQLITE Error error; - Path sticker_file = config_get_path(CONF_STICKER_FILE, error); - if (sticker_file.IsNull() && error.IsDefined()) - FatalError(error); + auto sticker_file = config_get_path(CONF_STICKER_FILE, error); + if (sticker_file.IsNull()) { + if (error.IsDefined()) + FatalError(error); + return; + } if (!sticker_global_init(std::move(sticker_file), error)) FatalError(error); @@ -219,7 +222,7 @@ glue_sticker_init(void) static bool glue_state_file_init(Error &error) { - Path path_fs = config_get_path(CONF_STATE_FILE, error); + auto path_fs = config_get_path(CONF_STATE_FILE, error); if (path_fs.IsNull()) return !error.IsDefined(); |