diff options
author | Max Kellermann <max@duempel.org> | 2015-02-25 19:10:47 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-25 19:10:51 +0100 |
commit | 00b0f6ad51e4fe02d6e3955e6bc15f8ee1de6eb3 (patch) | |
tree | d58fe363b538270383afa4da3b7b23e909aefce9 /src/fs/io/FileReader.cxx | |
parent | fe1e467a493ac69dc52adc4a03b27a6c8d9ad1b9 (diff) | |
download | mpd-00b0f6ad51e4fe02d6e3955e6bc15f8ee1de6eb3.tar.gz mpd-00b0f6ad51e4fe02d6e3955e6bc15f8ee1de6eb3.tar.xz mpd-00b0f6ad51e4fe02d6e3955e6bc15f8ee1de6eb3.zip |
fs/io/File{Reader,OutputStream}: convert path to UTF-8 for error message
Diffstat (limited to 'src/fs/io/FileReader.cxx')
-rw-r--r-- | src/fs/io/FileReader.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fs/io/FileReader.cxx b/src/fs/io/FileReader.cxx index 01ffe95f2..a19f472e8 100644 --- a/src/fs/io/FileReader.cxx +++ b/src/fs/io/FileReader.cxx @@ -30,8 +30,10 @@ FileReader::FileReader(Path _path, Error &error) nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr)) { - if (handle == INVALID_HANDLE_VALUE) - error.FormatLastError("Failed to open %s", path.c_str()); + if (handle == INVALID_HANDLE_VALUE) { + const auto path_utf8 = path.ToUTF8(); + error.FormatLastError("Failed to open %s", path_utf8.c_str()); + } } size_t @@ -41,7 +43,9 @@ FileReader::Read(void *data, size_t size, Error &error) DWORD nbytes; if (!ReadFile(handle, data, size, &nbytes, nullptr)) { - error.FormatLastError("Failed to read from %s", path.c_str()); + const auto path_utf8 = path.ToUTF8(); + error.FormatLastError("Failed to read from %s", + path_utf8.c_str()); nbytes = 0; } |