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

Side by Side Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 1191933004: add file watching support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 6 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
OLDNEW
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 physical_file_system; 5 library physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/src/generated/java_io.dart'; 10 import 'package:analyzer/src/generated/java_io.dart';
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 return null; 67 return null;
68 } 68 }
69 } 69 }
70 70
71 /** 71 /**
72 * A `dart:io` based implementation of [File]. 72 * A `dart:io` based implementation of [File].
73 */ 73 */
74 class _PhysicalFile extends _PhysicalResource implements File { 74 class _PhysicalFile extends _PhysicalResource implements File {
75 _PhysicalFile(io.File file) : super(file); 75 _PhysicalFile(io.File file) : super(file);
76
77 @override
78 Stream<WatchEvent> get changes => new FileWatcher(_entry.path).events;
76 79
77 @override 80 @override
78 int get modificationStamp { 81 int get modificationStamp {
79 try { 82 try {
80 io.File file = _entry as io.File; 83 io.File file = _entry as io.File;
81 return file.lastModifiedSync().millisecondsSinceEpoch; 84 return file.lastModifiedSync().millisecondsSinceEpoch;
82 } on io.FileSystemException catch (exception) { 85 } on io.FileSystemException catch (exception) {
83 throw new FileSystemException(exception.path, exception.message); 86 throw new FileSystemException(exception.path, exception.message);
84 } 87 }
85 } 88 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 bool operator ==(other) { 208 bool operator ==(other) {
206 if (runtimeType != other.runtimeType) { 209 if (runtimeType != other.runtimeType) {
207 return false; 210 return false;
208 } 211 }
209 return path == other.path; 212 return path == other.path;
210 } 213 }
211 214
212 @override 215 @override
213 String toString() => path; 216 String toString() => path;
214 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698