| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #include <libgen.h> | 9 #include <libgen.h> |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 bool File::IsAbsolutePath(const char* pathname) { | 116 bool File::IsAbsolutePath(const char* pathname) { |
| 117 return (pathname != NULL && pathname[0] == '/'); | 117 return (pathname != NULL && pathname[0] == '/'); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 char* File::GetCanonicalPath(const char* pathname) { |
| 122 char* abs_path = NULL; |
| 123 if (pathname != NULL) { |
| 124 abs_path = realpath(pathname, NULL); |
| 125 assert(abs_path == NULL || IsAbsolutePath(abs_path)); |
| 126 } |
| 127 return abs_path; |
| 128 } |
| 129 |
| 130 |
| 121 const char* File::PathSeparator() { | 131 const char* File::PathSeparator() { |
| 122 return "/"; | 132 return "/"; |
| 123 } | 133 } |
| 124 | 134 |
| 125 | 135 |
| 126 const char* File::StringEscapedPathSeparator() { | 136 const char* File::StringEscapedPathSeparator() { |
| 127 return "/"; | 137 return "/"; |
| 128 } | 138 } |
| OLD | NEW |