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

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

Issue 9622001: Add the ability to get the current directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix windows Created 8 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 | Annotate | Revision Log
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 "bin/directory.h" 5 #include "bin/directory.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 370 }
371 ASSERT(errno == ELOOP || 371 ASSERT(errno == ELOOP ||
372 errno == ENAMETOOLONG || 372 errno == ENAMETOOLONG ||
373 errno == ENOENT || 373 errno == ENOENT ||
374 errno == ENOTDIR); 374 errno == ENOTDIR);
375 return DOES_NOT_EXIST; 375 return DOES_NOT_EXIST;
376 } 376 }
377 } 377 }
378 378
379 379
380 char* Directory::Current() {
381 return getcwd(NULL, 0);
382 }
383
384
380 bool Directory::Create(const char* dir_name) { 385 bool Directory::Create(const char* dir_name) {
381 // Create the directory with the permissions specified by the 386 // Create the directory with the permissions specified by the
382 // process umask. 387 // process umask.
383 return (TEMP_FAILURE_RETRY(mkdir(dir_name, 0777)) == 0); 388 return (TEMP_FAILURE_RETRY(mkdir(dir_name, 0777)) == 0);
384 } 389 }
385 390
386 391
387 int Directory::CreateTemp(const char* const_template, 392 int Directory::CreateTemp(const char* const_template,
388 char** path, 393 char** path,
389 char* os_error_message, 394 char* os_error_message,
(...skipping 28 matching lines...) Expand all
418 } 423 }
419 424
420 425
421 bool Directory::Delete(const char* dir_name, bool recursive) { 426 bool Directory::Delete(const char* dir_name, bool recursive) {
422 if (!recursive) { 427 if (!recursive) {
423 return (TEMP_FAILURE_RETRY(remove(dir_name)) == 0); 428 return (TEMP_FAILURE_RETRY(remove(dir_name)) == 0);
424 } else { 429 } else {
425 return DeleteRecursively(dir_name); 430 return DeleteRecursively(dir_name);
426 } 431 }
427 } 432 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698