OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 if (!GetTemporaryFolder(*path, true, &folder)) | 495 if (!GetTemporaryFolder(*path, true, &folder)) |
496 return false; | 496 return false; |
497 | 497 |
498 delete [] app_temp_path_; | 498 delete [] app_temp_path_; |
499 app_temp_path_ = CopyString(path->pathname()); | 499 app_temp_path_ = CopyString(path->pathname()); |
500 // TODO: atexit(DeleteFolderAndContents(app_temp_path_)); | 500 // TODO: atexit(DeleteFolderAndContents(app_temp_path_)); |
501 return true; | 501 return true; |
502 #endif | 502 #endif |
503 } | 503 } |
504 | 504 |
505 bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path, int64 *freebytes) { | 505 bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path, |
| 506 int64_t* freebytes) { |
506 #ifdef __native_client__ | 507 #ifdef __native_client__ |
507 return false; | 508 return false; |
508 #else // __native_client__ | 509 #else // __native_client__ |
509 ASSERT(NULL != freebytes); | 510 ASSERT(NULL != freebytes); |
510 // TODO: Consider making relative paths absolute using cwd. | 511 // TODO: Consider making relative paths absolute using cwd. |
511 // TODO: When popping off a symlink, push back on the components of the | 512 // TODO: When popping off a symlink, push back on the components of the |
512 // symlink, so we don't jump out of the target disk inadvertently. | 513 // symlink, so we don't jump out of the target disk inadvertently. |
513 Pathname existing_path(path.folder(), ""); | 514 Pathname existing_path(path.folder(), ""); |
514 while (!existing_path.folder().empty() && IsAbsent(existing_path)) { | 515 while (!existing_path.folder().empty() && IsAbsent(existing_path)) { |
515 existing_path.SetFolder(existing_path.parent_folder()); | 516 existing_path.SetFolder(existing_path.parent_folder()); |
516 } | 517 } |
517 #if defined(WEBRTC_ANDROID) | 518 #if defined(WEBRTC_ANDROID) |
518 struct statfs vfs; | 519 struct statfs vfs; |
519 memset(&vfs, 0, sizeof(vfs)); | 520 memset(&vfs, 0, sizeof(vfs)); |
520 if (0 != statfs(existing_path.pathname().c_str(), &vfs)) | 521 if (0 != statfs(existing_path.pathname().c_str(), &vfs)) |
521 return false; | 522 return false; |
522 #else | 523 #else |
523 struct statvfs vfs; | 524 struct statvfs vfs; |
524 memset(&vfs, 0, sizeof(vfs)); | 525 memset(&vfs, 0, sizeof(vfs)); |
525 if (0 != statvfs(existing_path.pathname().c_str(), &vfs)) | 526 if (0 != statvfs(existing_path.pathname().c_str(), &vfs)) |
526 return false; | 527 return false; |
527 #endif // WEBRTC_ANDROID | 528 #endif // WEBRTC_ANDROID |
528 #if defined(WEBRTC_LINUX) | 529 #if defined(WEBRTC_LINUX) |
529 *freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail; | 530 *freebytes = static_cast<int64_t>(vfs.f_bsize) * vfs.f_bavail; |
530 #elif defined(WEBRTC_MAC) | 531 #elif defined(WEBRTC_MAC) |
531 *freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail; | 532 *freebytes = static_cast<int64_t>(vfs.f_frsize) * vfs.f_bavail; |
532 #endif | 533 #endif |
533 | 534 |
534 return true; | 535 return true; |
535 #endif // !__native_client__ | 536 #endif // !__native_client__ |
536 } | 537 } |
537 | 538 |
538 Pathname UnixFilesystem::GetCurrentDirectory() { | 539 Pathname UnixFilesystem::GetCurrentDirectory() { |
539 Pathname cwd; | 540 Pathname cwd; |
540 char buffer[PATH_MAX]; | 541 char buffer[PATH_MAX]; |
541 char *path = getcwd(buffer, PATH_MAX); | 542 char *path = getcwd(buffer, PATH_MAX); |
(...skipping 21 matching lines...) Expand all Loading... |
563 | 564 |
564 } // namespace rtc | 565 } // namespace rtc |
565 | 566 |
566 #if defined(__native_client__) | 567 #if defined(__native_client__) |
567 extern "C" int __attribute__((weak)) | 568 extern "C" int __attribute__((weak)) |
568 link(const char* oldpath, const char* newpath) { | 569 link(const char* oldpath, const char* newpath) { |
569 errno = EACCES; | 570 errno = EACCES; |
570 return -1; | 571 return -1; |
571 } | 572 } |
572 #endif | 573 #endif |
OLD | NEW |