Chromium Code Reviews| Index: base/file_util_posix.cc |
| diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
| index 28d6a61578a4b50a063616a84cbc44ca2a8274e5..5683527790d48b616d2c008b55313e09db6103b0 100644 |
| --- a/base/file_util_posix.cc |
| +++ b/base/file_util_posix.cc |
| @@ -522,6 +522,21 @@ bool CreateDirectory(const FilePath& full_path) { |
| return true; |
| } |
| +// TODO(rkc): Refactor GetFileInfo and FileEnumerator to handle symlinks |
| +// correctly. http://code.google.com/p/chromium-os/issues/detail?id=15948 |
| +bool IsLink(const FilePath& file_path) { |
| + struct stat st; |
| + // If we can't lstat the file, it's safe to assume that the file won't at |
| + // least be a 'followable' link |
|
Evan Martin
2011/05/31 23:00:12
period
|
| + if (lstat(file_path.value().c_str(), &st) != 0) |
| + return false; |
| + |
| + if (S_ISLNK(st.st_mode)) |
| + return true; |
| + else |
| + return false; |
| +} |
| + |
| bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* results) { |
| stat_wrapper_t file_info; |
| if (CallStat(file_path.value().c_str(), &file_info) != 0) |