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

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: 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
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 758df5af8ae992811e4fcb7440ee69092fddfc81..453a3397a68d5e10e0a685e3dde599476bf2120e 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -32,6 +32,29 @@ 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)) {
+ printf("XXX\n");
Bill Hesse 2013/04/29 11:01:12 Remove debug printing.
Søren Gjesse 2013/04/29 11:59:15 Done.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698