| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.file_system.physical_file_system; | 5 library analyzer.file_system.physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 @override | 183 @override |
| 184 void writeAsBytesSync(List<int> bytes) { | 184 void writeAsBytesSync(List<int> bytes) { |
| 185 try { | 185 try { |
| 186 io.File file = _entry as io.File; | 186 io.File file = _entry as io.File; |
| 187 file.writeAsBytesSync(bytes); | 187 file.writeAsBytesSync(bytes); |
| 188 } on io.FileSystemException catch (exception) { | 188 } on io.FileSystemException catch (exception) { |
| 189 throw new FileSystemException(exception.path, exception.message); | 189 throw new FileSystemException(exception.path, exception.message); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 |
| 193 @override |
| 194 void writeAsStringSync(String content) { |
| 195 try { |
| 196 io.File file = _entry as io.File; |
| 197 file.writeAsStringSync(content); |
| 198 } on io.FileSystemException catch (exception) { |
| 199 throw new FileSystemException(exception.path, exception.message); |
| 200 } |
| 201 } |
| 192 } | 202 } |
| 193 | 203 |
| 194 /** | 204 /** |
| 195 * A `dart:io` based implementation of [Folder]. | 205 * A `dart:io` based implementation of [Folder]. |
| 196 */ | 206 */ |
| 197 class _PhysicalFolder extends _PhysicalResource implements Folder { | 207 class _PhysicalFolder extends _PhysicalResource implements Folder { |
| 198 _PhysicalFolder(io.Directory directory) : super(directory); | 208 _PhysicalFolder(io.Directory directory) : super(directory); |
| 199 | 209 |
| 200 @override | 210 @override |
| 201 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; | 211 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 timer.cancel(); | 353 timer.cancel(); |
| 344 } | 354 } |
| 345 }); | 355 }); |
| 346 return completer.future; | 356 return completer.future; |
| 347 } | 357 } |
| 348 _isSpawning = true; | 358 _isSpawning = true; |
| 349 _runner = await IsolateRunner.spawn(); | 359 _runner = await IsolateRunner.spawn(); |
| 350 return _runner; | 360 return _runner; |
| 351 } | 361 } |
| 352 } | 362 } |
| OLD | NEW |