OLD | NEW |
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 /** | 5 /** |
6 * [Directory] objects are used for working with directories. | 6 * [Directory] objects are used for working with directories. |
7 */ | 7 */ |
8 abstract class Directory { | 8 abstract class Directory { |
9 /** | 9 /** |
10 * Creates a directory object. The path is either an absolute path, | 10 * Creates a directory object. The path is either an absolute path, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 class DirectoryIOException implements Exception { | 178 class DirectoryIOException implements Exception { |
179 const DirectoryIOException([String this.message = "", | 179 const DirectoryIOException([String this.message = "", |
180 String this.path = "", | 180 String this.path = "", |
181 OSError this.osError = null]); | 181 OSError this.osError = null]); |
182 String toString() { | 182 String toString() { |
183 StringBuffer sb = new StringBuffer(); | 183 StringBuffer sb = new StringBuffer(); |
184 sb.add("DirectoryIOException"); | 184 sb.add("DirectoryIOException"); |
185 if (!message.isEmpty()) { | 185 if (!message.isEmpty) { |
186 sb.add(": $message"); | 186 sb.add(": $message"); |
187 if (path != null) { | 187 if (path != null) { |
188 sb.add(", path = $path"); | 188 sb.add(", path = $path"); |
189 } | 189 } |
190 if (osError != null) { | 190 if (osError != null) { |
191 sb.add(" ($osError)"); | 191 sb.add(" ($osError)"); |
192 } | 192 } |
193 } else if (osError != null) { | 193 } else if (osError != null) { |
194 sb.add(": $osError"); | 194 sb.add(": $osError"); |
195 if (path != null) { | 195 if (path != null) { |
196 sb.add(", path = $path"); | 196 sb.add(", path = $path"); |
197 } | 197 } |
198 } | 198 } |
199 return sb.toString(); | 199 return sb.toString(); |
200 } | 200 } |
201 final String message; | 201 final String message; |
202 final String path; | 202 final String path; |
203 final OSError osError; | 203 final OSError osError; |
204 } | 204 } |
OLD | NEW |