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

Unified Diff: sdk/lib/io/file_impl.dart

Issue 2698813002: [dart:io][windows] Make unicode characters display correctly. (Closed)
Patch Set: Address comments Created 3 years, 10 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 | « runtime/bin/utils_win.h ('k') | sdk/lib/io/stdio.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 3ae67e3e91d1bb31f7a216cb6842892df5d3da96..1a69a0d4a9807178ccdcc947523cadb0b9f4ee14 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -643,8 +643,25 @@ abstract class _RandomAccessFileOps {
length();
flush();
lock(int lock, int start, int end);
+ setTranslation(int translation);
}
+
+/**
+ * The translation mode of a File.
+ *
+ * Whether the data written to a file should be interpreted as text
+ * or binary data. This distinction is only meaningful on platforms that
+ * recognize a difference, in particular on Windows.
+ */
+enum _FileTranslation {
+ /// Data should be interpreted as text.
+ text,
+ /// Data should be interpreted as binary data.
+ binary,
+}
+
+
class _RandomAccessFile implements RandomAccessFile {
static bool _connectedResourceHandler = false;
@@ -656,9 +673,12 @@ class _RandomAccessFile implements RandomAccessFile {
_FileResourceInfo _resourceInfo;
_RandomAccessFileOps _ops;
+ _FileTranslation _translation;
+
_RandomAccessFile(int pointer, this.path) {
_ops = new _RandomAccessFileOps(pointer);
_resourceInfo = new _FileResourceInfo(this);
+ _translation = _FileTranslation.binary;
_maybeConnectHandler();
}
@@ -1059,6 +1079,15 @@ class _RandomAccessFile implements RandomAccessFile {
}
}
+ _FileTranslation get translation => _translation;
+
+ void set translation(_FileTranslation translation) {
+ if (_translation != translation) {
+ _ops.setTranslation(translation.index);
+ _translation = translation;
+ }
+ }
+
bool closed = false;
// Calling this function will increase the reference count on the native
« no previous file with comments | « runtime/bin/utils_win.h ('k') | sdk/lib/io/stdio.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698