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

Side by Side Diff: sdk/lib/io/common.dart

Issue 2681683005: [dart:io] Adds functions to set file access and modification time (Closed)
Patch Set: Update changelog 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 unified diff | Download patch
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/io_patch.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 // Constants used when working with native ports. 7 // Constants used when working with native ports.
8 // These must match the constants in runtime/bin/dartutils.h class CObject. 8 // These must match the constants in runtime/bin/dartutils.h class CObject.
9 const int _SUCCESS_RESPONSE = 0; 9 const int _SUCCESS_RESPONSE = 0;
10 const int _ILLEGAL_ARGUMENT_RESPONSE = 1; 10 const int _ILLEGAL_ARGUMENT_RESPONSE = 1;
11 const int _OSERROR_RESPONSE = 2; 11 const int _OSERROR_RESPONSE = 2;
12 const int _FILE_CLOSED_RESPONSE = 3; 12 const int _FILE_CLOSED_RESPONSE = 3;
13 13
14 const int _ERROR_RESPONSE_ERROR_TYPE = 0; 14 const int _ERROR_RESPONSE_ERROR_TYPE = 0;
15 const int _OSERROR_RESPONSE_ERROR_CODE = 1; 15 const int _OSERROR_RESPONSE_ERROR_CODE = 1;
16 const int _OSERROR_RESPONSE_MESSAGE = 2; 16 const int _OSERROR_RESPONSE_MESSAGE = 2;
17 17
18 // Functions used to receive exceptions from native ports. 18 // Functions used to receive exceptions from native ports.
19 bool _isErrorResponse(response) => 19 bool _isErrorResponse(response) =>
20 response is List && response[0] != _SUCCESS_RESPONSE; 20 response is List && response[0] != _SUCCESS_RESPONSE;
21 21
22 /** 22 /**
23 * Returns an Exception or an Error 23 * Returns an Exception or an Error
24 */ 24 */
25 _exceptionFromResponse(response, String message, String path) { 25 _exceptionFromResponse(response, String message, String path) {
26 assert(_isErrorResponse(response)); 26 assert(_isErrorResponse(response));
27 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) { 27 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
28 case _ILLEGAL_ARGUMENT_RESPONSE: 28 case _ILLEGAL_ARGUMENT_RESPONSE:
29 return new ArgumentError(); 29 return new ArgumentError("$message: $path");
30 case _OSERROR_RESPONSE: 30 case _OSERROR_RESPONSE:
31 var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE], 31 var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
32 response[_OSERROR_RESPONSE_ERROR_CODE]); 32 response[_OSERROR_RESPONSE_ERROR_CODE]);
33 return new FileSystemException(message, path, err); 33 return new FileSystemException(message, path, err);
34 case _FILE_CLOSED_RESPONSE: 34 case _FILE_CLOSED_RESPONSE:
35 return new FileSystemException("File closed", path); 35 return new FileSystemException("File closed", path);
36 default: 36 default:
37 return new Exception("Unknown error"); 37 return new Exception("Unknown error");
38 } 38 }
39 } 39 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 newBuffer[i] = value; 115 newBuffer[i] = value;
116 j++; 116 j++;
117 } 117 }
118 return new _BufferAndStart(newBuffer, 0); 118 return new _BufferAndStart(newBuffer, 0);
119 } 119 }
120 120
121 121
122 class _IOCrypto { 122 class _IOCrypto {
123 external static Uint8List getRandomBytes(int count); 123 external static Uint8List getRandomBytes(int count);
124 } 124 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/io_patch.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698