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

Unified Diff: runtime/lib/uri.cc

Issue 23686021: Add property base to the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 7 years, 3 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 | « no previous file | runtime/lib/uri_patch.dart » ('j') | runtime/vm/bootstrap_natives.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/uri.cc
diff --git a/runtime/lib/uri.cc b/runtime/lib/uri.cc
index f75d2ecc4d242a50a219404a12c631c3066a6256..a883353ebb9f577cd63d446f85f50f5c8f7f8974 100644
--- a/runtime/lib/uri.cc
+++ b/runtime/lib/uri.cc
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "bin/directory.h"
+#include "bin/utils.h"
#include "vm/bootstrap_natives.h"
#include "vm/native_entry.h"
#include "vm/object.h"
@@ -9,11 +11,27 @@
namespace dart {
DEFINE_NATIVE_ENTRY(Uri_isWindowsPlatform, 0) {
-#if defined(_WIN32)
+#if defined(TARGET_OS_WINDOWS)
return Bool::True().raw();
#else
return Bool::False().raw();
#endif
}
+
+DEFINE_NATIVE_ENTRY(Uri_currentDirectory, 0) {
+ char* current = bin::Directory::Current();
+ if (current == NULL) {
+ bin::OSError err;
+ const String& error = String::Handle(String::NewFormatted(
+ "Error determining current directory: %s", err.message()));
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, error);
+ Exceptions::ThrowByType(Exceptions::kUnsupported, args);
+ }
+
+ const String& result = String::Handle(String::New(current));
+ return result.raw();
+}
+
} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/uri_patch.dart » ('j') | runtime/vm/bootstrap_natives.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698