diff options
Diffstat (limited to 'src/main/cpp/util/file_posix.cc')
-rw-r--r-- | src/main/cpp/util/file_posix.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/cpp/util/file_posix.cc b/src/main/cpp/util/file_posix.cc index 076bff2bfd..daa465af94 100644 --- a/src/main/cpp/util/file_posix.cc +++ b/src/main/cpp/util/file_posix.cc @@ -251,6 +251,18 @@ int RenameDirectory(const std::string &old_name, const std::string &new_name) { } } +bool ReadDirectorySymlink(const string &name, string *result) { + char buf[PATH_MAX + 1]; + int len = readlink(name.c_str(), buf, PATH_MAX); + if (len < 0) { + return false; + } + + buf[len] = 0; + *result = buf; + return true; +} + bool UnlinkPath(const string &file_path) { return unlink(file_path.c_str()) == 0; } |