Index: runtime/bin/dartutils.cc |
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc |
index d29c947deb5b631eafec385d03de59953b06a71d..08a8452eba349cab62e0f9fda888ef7acff185a9 100644 |
--- a/runtime/bin/dartutils.cc |
+++ b/runtime/bin/dartutils.cc |
@@ -233,6 +233,16 @@ const char* DartUtils::RemoveScheme(const char* url) { |
} |
+char* DartUtils::DirName(const char* url) { |
+ const char* slash = strrchr(url, File::PathSeparator()[0]); |
+ if (slash == NULL) { |
+ return strdup(url); |
+ } else { |
+ return strndup(url, slash - url + 1); |
+ } |
+} |
+ |
+ |
void* DartUtils::OpenFile(const char* name, bool write) { |
File* file = File::Open(name, write ? File::kWriteTruncate : File::kRead); |
return reinterpret_cast<void*>(file); |