Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: runtime/bin/directory_linux.cc

Issue 1800863002: Cleanup in //runtime/bin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Windows fixes Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 9
10 #include <dirent.h> // NOLINT 10 #include <dirent.h> // NOLINT
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 const char* Directory::Current() { 377 const char* Directory::Current() {
378 char buffer[PATH_MAX]; 378 char buffer[PATH_MAX];
379 if (getcwd(buffer, PATH_MAX) == NULL) { 379 if (getcwd(buffer, PATH_MAX) == NULL) {
380 return NULL; 380 return NULL;
381 } 381 }
382 return DartUtils::ScopedCopyCString(buffer); 382 return DartUtils::ScopedCopyCString(buffer);
383 } 383 }
384 384
385 385
386 bool Directory::SetCurrent(const char* path) { 386 bool Directory::SetCurrent(const char* path) {
387 return NO_RETRY_EXPECTED(chdir(path)) == 0; 387 return (NO_RETRY_EXPECTED(chdir(path)) == 0);
388 } 388 }
389 389
390 390
391 bool Directory::Create(const char* dir_name) { 391 bool Directory::Create(const char* dir_name) {
392 // Create the directory with the permissions specified by the 392 // Create the directory with the permissions specified by the
393 // process umask. 393 // process umask.
394 int result = NO_RETRY_EXPECTED(mkdir(dir_name, 0777)); 394 int result = NO_RETRY_EXPECTED(mkdir(dir_name, 0777));
395 // If the directory already exists, treat it as a success. 395 // If the directory already exists, treat it as a success.
396 if ((result == -1) && (errno == EEXIST)) { 396 if ((result == -1) && (errno == EEXIST)) {
397 return (Exists(dir_name) == EXISTS); 397 return (Exists(dir_name) == EXISTS);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return DeleteRecursively(&path); 462 return DeleteRecursively(&path);
463 } 463 }
464 } 464 }
465 465
466 466
467 bool Directory::Rename(const char* path, const char* new_path) { 467 bool Directory::Rename(const char* path, const char* new_path) {
468 ExistsResult exists = Exists(path); 468 ExistsResult exists = Exists(path);
469 if (exists != EXISTS) { 469 if (exists != EXISTS) {
470 return false; 470 return false;
471 } 471 }
472 return NO_RETRY_EXPECTED(rename(path, new_path)) == 0; 472 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0);
473 } 473 }
474 474
475 } // namespace bin 475 } // namespace bin
476 } // namespace dart 476 } // namespace dart
477 477
478 #endif // defined(TARGET_OS_LINUX) 478 #endif // defined(TARGET_OS_LINUX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698