Commit f4f21f46 authored by Max Kellermann's avatar Max Kellermann

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

parent d09b8b5b
...@@ -41,23 +41,28 @@ CheckDirectoryReadable(Path path_fs) ...@@ -41,23 +41,28 @@ CheckDirectoryReadable(Path path_fs)
} }
if (!fi.IsDirectory()) { if (!fi.IsDirectory()) {
const auto path_utf8 = path_fs.ToUTF8();
FormatError(config_domain, FormatError(config_domain,
"Not a directory: %s", path_fs.c_str()); "Not a directory: %s", path_utf8.c_str());
return; return;
} }
#ifndef WIN32 #ifndef WIN32
const auto x = AllocatedPath::Build(path_fs, const auto x = AllocatedPath::Build(path_fs,
PathTraitsFS::CURRENT_DIRECTORY); 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, FormatError(config_domain,
"No permission to traverse (\"execute\") directory: %s", "No permission to traverse (\"execute\") directory: %s",
path_fs.c_str()); path_utf8.c_str());
}
#endif #endif
const DirectoryReader reader(path_fs); 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, FormatError(config_domain,
"No permission to read directory: %s", path_fs.c_str()); "No permission to read directory: %s",
path_utf8.c_str());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment