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

Unified Diff: runtime/bin/directory.cc

Issue 23444037: dart:io | Change File.fullPath to FileSystemEntity.resolveSymbolicLinks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Document resolution of link\.. on Windows. 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
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 0f771eecbdf38cde1ef019fd9b56c05e459db771..5d73ab8cfea18cf31dd84c10ae0a147351a832ab 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -5,6 +5,7 @@
#include "bin/directory.h"
#include "bin/dartutils.h"
+#include "bin/file.h"
#include "bin/thread.h"
#include "include/dart_api.h"
#include "platform/assert.h"
@@ -291,6 +292,23 @@ static CObject* DirectoryRenameRequest(const CObjectArray& request,
}
+static CObject* DirectoryResolveSymbolicLinksRequest(
Anders Johnsen 2013/09/09 12:24:48 Why don't we use the file.cc version for all paths
Bill Hesse 2013/09/13 06:34:13 Done.
+ const CObjectArray& request) {
+ if (request.Length() == 2 && request[1]->IsString()) {
+ CObjectString filename(request[1]);
+ char* result = File::GetCanonicalPath(filename.CString());
+ if (result != NULL) {
+ CObject* path = new CObjectString(CObject::NewString(result));
+ free(result);
+ return path;
+ } else {
+ return CObject::NewOSError();
+ }
+ }
+ return CObject::IllegalArgumentError();
+}
+
+
static void DirectoryService(Dart_Port dest_port_id,
Dart_Port reply_port_id,
Dart_CObject* message) {
@@ -324,6 +342,9 @@ static void DirectoryService(Dart_Port dest_port_id,
case Directory::kRenameRequest:
response = DirectoryRenameRequest(request, reply_port_id);
break;
+ case Directory::kResolveSymbolicLinksRequest:
+ response = DirectoryResolveSymbolicLinksRequest(request);
+ break;
default:
UNREACHABLE();
}
« no previous file with comments | « runtime/bin/directory.h ('k') | runtime/bin/file.h » ('j') | runtime/bin/file_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698