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

Unified Diff: runtime/bin/directory_macos.cc

Issue 3001963002: [dart:io] Namespaces for file IO (Closed)
Patch Set: Fuchsia fix Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/directory_linux.cc ('k') | runtime/bin/directory_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_macos.cc
diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc
index 8fe39782773c602322282da81f8785737bc701be..5e5fd2a3a672a54b3c11726d419a186a440ecf72 100644
--- a/runtime/bin/directory_macos.cc
+++ b/runtime/bin/directory_macos.cc
@@ -16,6 +16,7 @@
#include "bin/dartutils.h"
#include "bin/file.h"
+#include "bin/namespace.h"
#include "bin/platform.h"
#include "platform/signal_blocker.h"
@@ -328,7 +329,7 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
-Directory::ExistsResult Directory::Exists(const char* dir_name) {
+Directory::ExistsResult Directory::Exists(Namespace* namespc, const char* dir_name) {
struct stat entry_info;
int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info));
if (success == 0) {
@@ -358,31 +359,18 @@ char* Directory::CurrentNoScope() {
return getcwd(NULL, 0);
}
-const char* Directory::Current() {
- char buffer[PATH_MAX];
- if (getcwd(buffer, PATH_MAX) == NULL) {
- return NULL;
- }
- return DartUtils::ScopedCopyCString(buffer);
-}
-
-bool Directory::SetCurrent(const char* path) {
- int result = NO_RETRY_EXPECTED(chdir(path));
- return (result == 0);
-}
-
-bool Directory::Create(const char* dir_name) {
+bool Directory::Create(Namespace* namespc, const char* dir_name) {
// Create the directory with the permissions specified by the
// process umask.
int result = NO_RETRY_EXPECTED(mkdir(dir_name, 0777));
// If the directory already exists, treat it as a success.
if ((result == -1) && (errno == EEXIST)) {
- return (Exists(dir_name) == EXISTS);
+ return (Exists(namespc, dir_name) == EXISTS);
}
return (result == 0);
}
-const char* Directory::SystemTemp() {
+const char* Directory::SystemTemp(Namespace* namespc) {
PathBuffer path;
const char* temp_dir = getenv("TMPDIR");
if (temp_dir == NULL) {
@@ -403,7 +391,7 @@ const char* Directory::SystemTemp() {
return path.AsScopedString();
}
-const char* Directory::CreateTemp(const char* prefix) {
+const char* Directory::CreateTemp(Namespace* namespc, const char* prefix) {
// Returns a new, unused directory name, adding characters to the end
// of prefix. Creates the directory with the permissions specified
// by the process umask.
@@ -426,10 +414,10 @@ const char* Directory::CreateTemp(const char* prefix) {
return path.AsScopedString();
}
-bool Directory::Delete(const char* dir_name, bool recursive) {
+bool Directory::Delete(Namespace* namespc, const char* dir_name, bool recursive) {
if (!recursive) {
- if ((File::GetType(dir_name, false) == File::kIsLink) &&
- (File::GetType(dir_name, true) == File::kIsDirectory)) {
+ if ((File::GetType(namespc, dir_name, false) == File::kIsLink) &&
+ (File::GetType(namespc, dir_name, true) == File::kIsDirectory)) {
return (NO_RETRY_EXPECTED(unlink(dir_name)) == 0);
}
return (NO_RETRY_EXPECTED(rmdir(dir_name)) == 0);
@@ -442,8 +430,8 @@ bool Directory::Delete(const char* dir_name, bool recursive) {
}
}
-bool Directory::Rename(const char* path, const char* new_path) {
- ExistsResult exists = Exists(path);
+bool Directory::Rename(Namespace* namespc, const char* path, const char* new_path) {
+ ExistsResult exists = Exists(namespc, path);
if (exists != EXISTS) {
return false;
}
« no previous file with comments | « runtime/bin/directory_linux.cc ('k') | runtime/bin/directory_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698