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

Unified Diff: runtime/bin/file.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.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index ed86895d24a95f229ebbbc07ee1a5e0e2b2d285b..62510de21c38919972f8cc10663979ccbc2e825d 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -320,6 +320,21 @@ void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ const char* str =
+ DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
+ char* str_copy = strdup(str);
+ char* path = File::GetContainingDirectory(str_copy);
+ if (path != NULL) {
+ Dart_SetReturnValue(args, Dart_NewString(path));
+ }
+ free(str_copy);
+ free(path);
+ Dart_ExitScope();
+}
+
+
void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) {
Dart_EnterScope();
const char* str =
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file.dart » ('j') | runtime/bin/file_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698