}
bool touch_file(const pal::string_t& path);
- bool realpath(string_t* path);
+ bool realpath(string_t* path, bool skip_error_logging = false);
bool file_exists(const string_t& path);
inline bool directory_exists(const string_t& path) { return file_exists(path); }
void readdir(const string_t& path, const string_t& pattern, std::vector<pal::string_t>* list);
return (recv->length() > 0);
}
-bool pal::realpath(pal::string_t* path)
+bool pal::realpath(pal::string_t* path, bool skip_error_logging)
{
auto resolved = ::realpath(path->c_str(), nullptr);
if (resolved == nullptr)
{
return false;
}
- perror("realpath()");
+
+ if (!skip_error_logging)
+ {
+ perror("realpath()");
+ }
+
return false;
}
+
path->assign(resolved);
::free(resolved);
return true;
}
// Return if path is valid and file exists, return true and adjust path as appropriate.
-bool pal::realpath(string_t* path)
+bool pal::realpath(string_t* path, bool skip_error_logging)
{
if (LongFile::IsNormalized(path->c_str()))
{
auto size = ::GetFullPathNameW(path->c_str(), MAX_PATH, buf, nullptr);
if (size == 0)
{
- trace::error(_X("Error resolving full path [%s]"), path->c_str());
+ if (!skip_error_logging)
+ {
+ trace::error(_X("Error resolving full path [%s]"), path->c_str());
+ }
return false;
}
if (size == 0)
{
- trace::error(_X("Error resolving full path [%s]"), path->c_str());
+ if (!skip_error_logging)
+ {
+ trace::error(_X("Error resolving full path [%s]"), path->c_str());
+ }
return false;
}
}
string_t tmp(path);
- return pal::realpath(&tmp);
+ return pal::realpath(&tmp, true);
}
static void readdir(const pal::string_t& path, const pal::string_t& pattern, bool onlydirectories, std::vector<pal::string_t>* list)