| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } while (abs_path == NULL && errno == EINTR); | 274 } while (abs_path == NULL && errno == EINTR); |
| 275 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path)); | 275 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path)); |
| 276 if (abs_path != resolved) { | 276 if (abs_path != resolved) { |
| 277 free(resolved); | 277 free(resolved); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 return abs_path; | 280 return abs_path; |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 char* File::GetContainingDirectory(char* pathname) { | |
| 285 // Report errors for non-regular files. | |
| 286 struct stat st; | |
| 287 if (TEMP_FAILURE_RETRY(stat(pathname, &st)) == 0) { | |
| 288 if (!S_ISREG(st.st_mode)) { | |
| 289 errno = (S_ISDIR(st.st_mode)) ? EISDIR : ENOENT; | |
| 290 return NULL; | |
| 291 } | |
| 292 } else { | |
| 293 return NULL; | |
| 294 } | |
| 295 char* path = NULL; | |
| 296 do { | |
| 297 path = dirname(pathname); | |
| 298 } while (path == NULL && errno == EINTR); | |
| 299 return GetCanonicalPath(path); | |
| 300 } | |
| 301 | |
| 302 | |
| 303 const char* File::PathSeparator() { | 284 const char* File::PathSeparator() { |
| 304 return "/"; | 285 return "/"; |
| 305 } | 286 } |
| 306 | 287 |
| 307 | 288 |
| 308 const char* File::StringEscapedPathSeparator() { | 289 const char* File::StringEscapedPathSeparator() { |
| 309 return "/"; | 290 return "/"; |
| 310 } | 291 } |
| 311 | 292 |
| 312 | 293 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return (file_1_info.st_ino == file_2_info.st_ino && | 332 return (file_1_info.st_ino == file_2_info.st_ino && |
| 352 file_1_info.st_dev == file_2_info.st_dev) ? | 333 file_1_info.st_dev == file_2_info.st_dev) ? |
| 353 File::kIdentical : | 334 File::kIdentical : |
| 354 File::kDifferent; | 335 File::kDifferent; |
| 355 } | 336 } |
| 356 | 337 |
| 357 } // namespace bin | 338 } // namespace bin |
| 358 } // namespace dart | 339 } // namespace dart |
| 359 | 340 |
| 360 #endif // defined(TARGET_OS_ANDROID) | 341 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |