fs/CheckFile: convert path to UTF-8 for error message

This commit is contained in:
Max Kellermann 2015-02-28 21:30:51 +01:00
parent d09b8b5bd7
commit f4f21f462d
1 changed files with 11 additions and 6 deletions

View File

@ -41,23 +41,28 @@ CheckDirectoryReadable(Path path_fs)
}
if (!fi.IsDirectory()) {
const auto path_utf8 = path_fs.ToUTF8();
FormatError(config_domain,
"Not a directory: %s", path_fs.c_str());
"Not a directory: %s", path_utf8.c_str());
return;
}
#ifndef WIN32
const auto x = AllocatedPath::Build(path_fs,
PathTraitsFS::CURRENT_DIRECTORY);
if (!GetFileInfo(x, fi) && errno == EACCES)
if (!GetFileInfo(x, fi) && errno == EACCES) {
const auto path_utf8 = path_fs.ToUTF8();
FormatError(config_domain,
"No permission to traverse (\"execute\") directory: %s",
path_fs.c_str());
path_utf8.c_str());
}
#endif
const DirectoryReader reader(path_fs);
if (reader.HasFailed() && errno == EACCES)
if (reader.HasFailed() && errno == EACCES) {
const auto path_utf8 = path_fs.ToUTF8();
FormatError(config_domain,
"No permission to read directory: %s", path_fs.c_str());
"No permission to read directory: %s",
path_utf8.c_str());
}
}