aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io/FileOutputStream.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-02-25 19:10:47 +0100
committerMax Kellermann <max@duempel.org>2015-02-25 19:10:51 +0100
commit00b0f6ad51e4fe02d6e3955e6bc15f8ee1de6eb3 (patch)
treed58fe363b538270383afa4da3b7b23e909aefce9 /src/fs/io/FileOutputStream.cxx
parentfe1e467a493ac69dc52adc4a03b27a6c8d9ad1b9 (diff)
downloadmpd-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/FileOutputStream.cxx')
-rw-r--r--src/fs/io/FileOutputStream.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index cdaf12ec2..6cec024ad 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -43,8 +43,11 @@ FileOutputStream::FileOutputStream(Path _path, Error &error)
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH,
nullptr))
{
- if (handle == INVALID_HANDLE_VALUE)
- error.FormatLastError("Failed to create %s", path.c_str());
+ if (handle == INVALID_HANDLE_VALUE) {
+ const auto path_utf8 = path.ToUTF8();
+ error.FormatLastError("Failed to create %s",
+ path_utf8.c_str());
+ }
}
bool
@@ -54,13 +57,17 @@ FileOutputStream::Write(const void *data, size_t size, Error &error)
DWORD nbytes;
if (!WriteFile(handle, data, size, &nbytes, nullptr)) {
- error.FormatLastError("Failed to write to %s", path.c_str());
+ const auto path_utf8 = path.ToUTF8();
+ error.FormatLastError("Failed to write to %s",
+ path_utf8.c_str());
return false;
}
if (size_t(nbytes) != size) {
+ const auto path_utf8 = path.ToUTF8();
error.FormatLastError(ERROR_DISK_FULL,
- "Failed to write to %s", path.c_str());
+ "Failed to write to %s",
+ path_utf8.c_str());
return false;
}