| Index: base/file_util_posix.cc
|
| diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
|
| index e0a1a55e066738e8f1d9025324a4825e58d96c05..e71051eca763f5c51890e10cb04a75d037c8d708 100644
|
| --- a/base/file_util_posix.cc
|
| +++ b/base/file_util_posix.cc
|
| @@ -373,6 +373,29 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes) {
|
| return total_read == bytes;
|
| }
|
|
|
| +bool CreateSymbolicLink(const FilePath& target_path,
|
| + const FilePath& symlink_path) {
|
| + DCHECK(!symlink_path.empty());
|
| + DCHECK(!target_path.empty());
|
| + return ::symlink(target_path.value().c_str(),
|
| + symlink_path.value().c_str()) != -1;
|
| +}
|
| +
|
| +bool ReadSymbolicLink(const FilePath& symlink_path,
|
| + FilePath* target_path) {
|
| + DCHECK(!symlink_path.empty());
|
| + DCHECK(target_path);
|
| + char buf[PATH_MAX];
|
| + ssize_t count = ::readlink(symlink_path.value().c_str(), buf, arraysize(buf));
|
| +
|
| + if (count <= 0)
|
| + return false;
|
| +
|
| + *target_path = FilePath(FilePath::StringType(buf, count));
|
| +
|
| + return true;
|
| +}
|
| +
|
| // Creates and opens a temporary file in |directory|, returning the
|
| // file descriptor. |path| is set to the temporary file path.
|
| // This function does NOT unlink() the file.
|
|
|