Chromium Code Reviews| Index: sdk/lib/io/file_impl.dart |
| diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart |
| index dce4cbc742bfb130997f34f28b209e492ede8684..1a12298b6441a36804df942dbe9c6d505d819911 100644 |
| --- a/sdk/lib/io/file_impl.dart |
| +++ b/sdk/lib/io/file_impl.dart |
| @@ -248,10 +248,6 @@ class _File extends FileSystemEntity implements File { |
| File get absolute => new File(_absolutePath); |
| - Future<FileStat> stat() => FileStat.stat(path); |
| - |
| - FileStat statSync() => FileStat.statSync(path); |
| - |
| Future<File> create({bool recursive: false}) { |
| var result = recursive ? parent.create(recursive: true) |
| : new Future.value(null); |
| @@ -380,6 +376,50 @@ class _File extends FileSystemEntity implements File { |
| return result; |
| } |
| + Future<DateTime> lastAccessed() { |
| + return _IOService._dispatch(_FILE_LAST_ACCESSED, [path]).then((response) { |
| + if (_isErrorResponse(response)) { |
| + throw _exceptionFromResponse(response, |
| + "Cannot retrieve access time", |
| + path); |
| + } |
| + return new DateTime.fromMillisecondsSinceEpoch(response); |
| + }); |
| + } |
| + |
| + external static _lastAccessed(String path); |
| + |
| + DateTime lastAccessedSync() { |
| + var ms = _lastAccessed(path); |
| + throwIfError(ms, "Cannot retrieve access time", path); |
| + return new DateTime.fromMillisecondsSinceEpoch(ms); |
| + } |
| + |
| + Future<File> setLastAccessed(DateTime time) { |
|
Lasse Reichstein Nielsen
2017/02/09 15:28:03
Future<File>->Future
zra
2017/02/09 17:21:39
Done.
|
| + int millis = time.millisecondsSinceEpoch; |
| + return _IOService._dispatch(_FILE_SET_LAST_ACCESSED, [path, millis]) |
| + .then((response) { |
| + if (_isErrorResponse(response)) { |
| + throw _exceptionFromResponse(response, |
| + "Cannot set access time", |
| + path); |
| + } |
| + return this; |
|
Lasse Reichstein Nielsen
2017/02/09 15:28:04
return null;
zra
2017/02/09 17:21:39
Done.
|
| + }); |
| + } |
| + |
| + external static _setLastAccessed(String path, int millis); |
| + |
| + File setLastAccessedSync(DateTime time) { |
|
Lasse Reichstein Nielsen
2017/02/09 15:28:04
File->void
zra
2017/02/09 17:21:39
Done.
|
| + int millis = time.millisecondsSinceEpoch; |
| + var result = _setLastAccessed(path, millis); |
| + if (result is OSError) { |
| + throw new FileSystemException("Failed to set file access time", |
| + path, result); |
| + } |
| + return this; |
|
Lasse Reichstein Nielsen
2017/02/09 15:28:03
remove line.
zra
2017/02/09 17:21:39
Done.
|
| + } |
| + |
| Future<DateTime> lastModified() { |
| return _IOService._dispatch(_FILE_LAST_MODIFIED, [path]).then((response) { |
| if (_isErrorResponse(response)) { |
| @@ -399,6 +439,31 @@ class _File extends FileSystemEntity implements File { |
| return new DateTime.fromMillisecondsSinceEpoch(ms); |
| } |
| + Future<File> setLastModified(DateTime time) { |
|
Lasse Reichstein Nielsen
2017/02/09 15:28:04
As above.
zra
2017/02/09 17:21:39
Done.
|
| + int millis = time.millisecondsSinceEpoch; |
| + return _IOService._dispatch(_FILE_SET_LAST_MODIFIED, [path, millis]) |
| + .then((response) { |
| + if (_isErrorResponse(response)) { |
| + throw _exceptionFromResponse(response, |
| + "Cannot set modification time", |
| + path); |
| + } |
| + return this; |
| + }); |
| + } |
| + |
| + external static _setLastModified(String path, int millis); |
| + |
| + File setLastModifiedSync(DateTime time) { |
| + int millis = time.millisecondsSinceEpoch; |
| + var result = _setLastModified(path, millis); |
| + if (result is OSError) { |
| + throw new FileSystemException("Failed to set file modification time", |
| + path, result); |
| + } |
| + return this; |
| + } |
| + |
| external static _open(String path, int mode); |
| RandomAccessFile openSync({FileMode mode: FileMode.READ}) { |