| Index: runtime/bin/file_linux.cc
|
| diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
|
| index 459a69271a4f0055c0850da10d746ac525003ab3..ce0ef27bb26c5ea84f21e13424b345098c4d2f4e 100644
|
| --- a/runtime/bin/file_linux.cc
|
| +++ b/runtime/bin/file_linux.cc
|
| @@ -246,4 +246,20 @@ File::StdioHandleType File::GetStdioHandleType(int fd) {
|
| return kOther;
|
| }
|
|
|
| +
|
| +File::Type File::GetType(const char* pathname, bool follow_links) {
|
| + struct stat entry_info;
|
| + int stat_success;
|
| + if (follow_links) {
|
| + stat_success = TEMP_FAILURE_RETRY(stat(pathname, &entry_info));
|
| + } else {
|
| + stat_success = TEMP_FAILURE_RETRY(lstat(pathname, &entry_info));
|
| + }
|
| + if (stat_success == -1) return File::kDoesNotExist;
|
| + if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory;
|
| + if (S_ISREG(entry_info.st_mode)) return File::kIsFile;
|
| + if (S_ISLNK(entry_info.st_mode)) return File::kIsLink;
|
| + return File::kDoesNotExist;
|
| +}
|
| +
|
| #endif // defined(TARGET_OS_LINUX)
|
|
|