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

Unified Diff: runtime/bin/directory.cc

Issue 13896034: Add the ability to change the working directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed tests Created 7 years, 8 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.h ('k') | runtime/bin/directory_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 758df5af8ae992811e4fcb7440ee69092fddfc81..310cf8f8c2d9c327dca1f889021f56fda498e345 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -32,6 +32,28 @@ void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ int argc = Dart_GetNativeArgumentCount(args);
+ Dart_Handle path;
+ if (argc == 1) {
+ path = Dart_GetNativeArgument(args, 0);
+ }
+ if (argc != 1 || !Dart_IsString(path)) {
+ Dart_SetReturnValue(args, DartUtils::NewDartArgumentError(NULL));
+ } else {
+ if (Directory::SetCurrent(DartUtils::GetStringValue(path))) {
+ Dart_SetReturnValue(args, Dart_True());
+ } else {
+ Dart_Handle err = DartUtils::NewDartOSError();
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ Dart_SetReturnValue(args, err);
+ }
+ }
+ Dart_ExitScope();
+}
+
+
void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) {
static const int kExists = 1;
static const int kDoesNotExist = 0;
« no previous file with comments | « runtime/bin/directory.h ('k') | runtime/bin/directory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698