| 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 file_system; | 5 library file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:path/path.dart'; | 10 import 'package:path/path.dart'; |
| 11 import 'package:watcher/watcher.dart'; | 11 import 'package:watcher/watcher.dart'; |
| 12 | 12 |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * [File]s are leaf [Resource]s which contain data. | 15 * [File]s are leaf [Resource]s which contain data. |
| 16 */ | 16 */ |
| 17 abstract class File extends Resource { | 17 abstract class File extends Resource { |
| 18 /** | 18 /** |
| 19 * Return the last-modified stamp of the file. |
| 20 * Throws [FileSystemException] if the file does not exist. |
| 21 */ |
| 22 int get modificationStamp; |
| 23 |
| 24 /** |
| 19 * Create a new [Source] instance that serves this file. | 25 * Create a new [Source] instance that serves this file. |
| 20 */ | 26 */ |
| 21 Source createSource([Uri uri]); | 27 Source createSource([Uri uri]); |
| 22 } | 28 } |
| 23 | 29 |
| 24 | 30 |
| 25 /** | 31 /** |
| 32 * Base class for all file system exceptions. |
| 33 */ |
| 34 class FileSystemException implements Exception { |
| 35 final String path; |
| 36 final String message; |
| 37 |
| 38 FileSystemException(this.path, this.message); |
| 39 |
| 40 String toString() => 'FileSystemException(path=$path; message=$message)'; |
| 41 } |
| 42 |
| 43 |
| 44 /** |
| 26 * [Folder]s are [Resource]s which may contain files and/or other folders. | 45 * [Folder]s are [Resource]s which may contain files and/or other folders. |
| 27 */ | 46 */ |
| 28 abstract class Folder extends Resource { | 47 abstract class Folder extends Resource { |
| 29 /** | 48 /** |
| 30 * Watch for changes to the files inside this folder (and in any nested | 49 * Watch for changes to the files inside this folder (and in any nested |
| 31 * folders, including folders reachable via links). | 50 * folders, including folders reachable via links). |
| 32 */ | 51 */ |
| 33 Stream<WatchEvent> get changes; | 52 Stream<WatchEvent> get changes; |
| 34 | 53 |
| 35 /** | 54 /** |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Uri restoreAbsolute(Source source) => source.uri; | 170 Uri restoreAbsolute(Source source) => source.uri; |
| 152 | 171 |
| 153 /** | 172 /** |
| 154 * Return `true` if the given URI is a `file` URI. | 173 * Return `true` if the given URI is a `file` URI. |
| 155 * | 174 * |
| 156 * @param uri the URI being tested | 175 * @param uri the URI being tested |
| 157 * @return `true` if the given URI is a `file` URI | 176 * @return `true` if the given URI is a `file` URI |
| 158 */ | 177 */ |
| 159 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; | 178 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; |
| 160 } | 179 } |
| OLD | NEW |