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

Unified Diff: runtime/bin/file_win.cc

Issue 9416096: Implement File.directory() and File.directorySync() to get (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implement async version using isolate Created 8 years, 10 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
Index: runtime/bin/file_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 500e4ec101486f7fdb410b6a1cccb6a9ebec52df..c3aadb4e82fdd3a3bb4417cadc7bcbc257a6c5e6 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -175,6 +175,21 @@ char* File::GetCanonicalPath(const char* pathname) {
}
+char* File::GetContainingDirectory(char* pathname) {
+ ASSERT(Exists(pathname));
+ int required_size = GetFullPathName(pathname, 0, NULL, NULL);
+ char* path = static_cast<char*>(malloc(required_size));
+ char* file_part = NULL;
+ int written = GetFullPathName(pathname, required_size, path, &file_part);
+ ASSERT(written == (required_size - 1));
+ ASSERT(file_part != NULL);
+ ASSERT(file_part > path);
+ ASSERT(file_part[-1] == '\\');
+ file_part[-1] = '\0';
+ return path;
+}
+
+
const char* File::PathSeparator() {
return "\\";
}

Powered by Google App Engine
This is Rietveld 408576698