From feb8d5b82f3e7c67806d5efbef1e0b86170ec6dd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Jan 2013 17:23:35 +0100 Subject: ConfigFile, CommandLine: use the Path class --- src/ConfigFile.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ConfigFile.cxx') diff --git a/src/ConfigFile.cxx b/src/ConfigFile.cxx index 614bb4f91..02a705f43 100644 --- a/src/ConfigFile.cxx +++ b/src/ConfigFile.cxx @@ -27,6 +27,7 @@ extern "C" { } #include "fs/Path.hxx" +#include "fs/FileSystem.hxx" #include "mpd_error.h" #include @@ -347,20 +348,23 @@ config_read_block(FILE *fp, int *count, char *string, GError **error_r) } bool -config_read_file(const char *file, GError **error_r) +ReadConfigFile(const Path &path, GError **error_r) { + assert(!path.IsNull()); + const std::string path_utf8 = path.ToUTF8(); + FILE *fp; char string[MAX_STRING_SIZE + 1]; int count = 0; struct config_entry *entry; struct config_param *param; - g_debug("loading file %s", file); + g_debug("loading file %s", path_utf8.c_str()); - if (!(fp = fopen(file, "r"))) { + if (!(fp = FOpen(path, "r"))) { g_set_error(error_r, config_quark(), errno, "Failed to open %s: %s", - file, g_strerror(errno)); + path_utf8.c_str(), g_strerror(errno)); return false; } -- cgit v1.2.3