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

Unified Diff: runtime/bin/file.cc

Issue 12533008: dart:io | Add FileSystemEntity.typeSync to test for symbolic links. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add error-checking for arguments. Disable Windows implementation. Created 7 years, 9 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/file.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index 3a2c45500d72d8003443dd1d03979d13b4aaf50f..a3906d33588895482ac994f44385cf280bf24b0e 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -497,6 +497,26 @@ void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
+ Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) {
+ const char* str =
+ DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
+ bool follow_links =
+ DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
+ File::Type type = File::GetType(str, follow_links);
+ Dart_SetReturnValue(args, Dart_NewInteger(static_cast<int>(type)));
+ } else {
+ OSError os_error(-1, "Invalid argument", OSError::kUnknown);
+ Dart_Handle err = DartUtils::NewDartOSError(&os_error);
+ if (Dart_IsError(err)) Dart_PropagateError(err);
+ Dart_SetReturnValue(args, err);
+ }
+ Dart_ExitScope();
+}
+
+
static int64_t CObjectInt32OrInt64ToInt64(CObject* cobject) {
ASSERT(cobject->IsInt32OrInt64());
int64_t result;
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_android.cc » ('j') | runtime/bin/file_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698