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

Side by Side Diff: sdk/lib/io/file.dart

Issue 2681683005: [dart:io] Adds functions to set file access and modification time (Closed)
Patch Set: Fix sync functions' return types. Format. Created 3 years, 10 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * The modes in which a File can be opened. 8 * The modes in which a File can be opened.
9 */ 9 */
10 class FileMode { 10 class FileMode {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 /** 303 /**
304 * Returns a [File] instance whose path is the absolute path to [this]. 304 * Returns a [File] instance whose path is the absolute path to [this].
305 * 305 *
306 * The absolute path is computed by prefixing 306 * The absolute path is computed by prefixing
307 * a relative path with the current working directory, and returning 307 * a relative path with the current working directory, and returning
308 * an absolute path unchanged. 308 * an absolute path unchanged.
309 */ 309 */
310 File get absolute; 310 File get absolute;
311 311
312 /** 312 /**
313 * Get the last-modified time of the file. Returns a 313 * Gets the last-accessed time of the file. Returns a
314 * [:Future<DateTime>:] that completes with a [DateTime] object for the
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Comment is badly formatted (because it predates th
floitsch 2017/02/09 16:19:34 Also, please use back-ticks for code: `Future<Date
zra 2017/02/09 17:21:38 Done.
zra 2017/02/09 17:21:39 Acknowledged.
315 * access date.
316 */
317 Future<DateTime> lastAccessed();
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Feels like it should be a getter ... but there is
floitsch 2017/02/09 16:19:34 It should still be a getter: `lastAccessed` is a f
zra 2017/02/09 17:21:39 Acknowledged.
zra 2017/02/09 17:21:39 Acknowledged.
318
319 /**
320 * Gets the last-accessed time of the file. Throws an exception
321 * if the file does not exist.
322 *
323 * Throws a [FileSystemException] if the operation fails.
Lasse Reichstein Nielsen 2017/02/09 15:28:03 /** * Get the last-accessed time of the file. *
floitsch 2017/02/09 16:19:35 Agree with Lasse: As a general guideline: Start wi
zra 2017/02/09 17:21:39 Done.
zra 2017/02/09 17:21:39 Acknowledged.
324 */
325 DateTime lastAccessedSync();
326
327 /**
328 * Modifies the time the file was last accessed.
329 *
330 * Returns a [:Future<File>:] that completes with this
floitsch 2017/02/09 16:19:34 Please use `backticks` for code. The [:old_style:]
zra 2017/02/09 17:21:39 Replaced here and elsewhere.
331 * [File] when the attributes have been set. If the access time
Lasse Reichstein Nielsen 2017/02/09 15:28:03 attributes have -> time has (there is only one att
zra 2017/02/09 17:21:39 Done.
332 * cannot be set, the future completes with an exception.
333 */
334 Future<File> setLastAccessed(DateTime time);
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Just return Future, and complete with null.
zra 2017/02/09 17:21:39 Done.
335
336 /**
337 * Synchronously modifies the time the file was last accessed.
338 *
339 * If the attributes cannot be set, throws a [FileSystemException].
Lasse Reichstein Nielsen 2017/02/09 15:28:03 attributes -> attribute (or just "time"). I'd pre
zra 2017/02/09 17:21:39 Done.
340 */
341 File setLastAccessedSync(DateTime time);
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Return void.
zra 2017/02/09 17:21:38 Done.
342
343 /**
344 * Gets the last-modified time of the file. Returns a
314 * [:Future<DateTime>:] that completes with a [DateTime] object for the 345 * [:Future<DateTime>:] that completes with a [DateTime] object for the
315 * modification date. 346 * modification date.
316 */ 347 */
317 Future<DateTime> lastModified(); 348 Future<DateTime> lastModified();
318 349
319 /** 350 /**
320 * Get the last-modified time of the file. Throws an exception 351 * Gets the last-modified time of the file. Throws an exception
321 * if the file does not exist. 352 * if the file does not exist.
322 * 353 *
323 * Throws a [FileSystemException] if the operation fails. 354 * Throws a [FileSystemException] if the operation fails.
324 */ 355 */
325 DateTime lastModifiedSync(); 356 DateTime lastModifiedSync();
326 357
327 /** 358 /**
359 * Modifies the time the file was last modified.
360 *
361 * Returns a [:Future<File>:] that completes with this
362 * [File] when the attributes have been set. If the modification
363 * time cannot be set, the future completes with an exception.
364 */
365 Future<File> setLastModified(DateTime time);
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Just return a `Future` that is completed with `nul
zra 2017/02/09 17:21:39 Done.
366
367 /**
368 * Synchronously modifies the time the file was last modified.
369 *
370 * If the attributes cannot be set, throws a [FileSystemException].
371 */
372 File setLastModifiedSync(DateTime time);
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Should just return void.
zra 2017/02/09 17:21:39 Done.
373
374 /**
328 * Open the file for random access operations. Returns a 375 * Open the file for random access operations. Returns a
329 * [:Future<RandomAccessFile>:] that completes with the opened 376 * [:Future<RandomAccessFile>:] that completes with the opened
330 * random access file. [RandomAccessFile]s must be closed using the 377 * random access file. [RandomAccessFile]s must be closed using the
331 * [RandomAccessFile.close] method. 378 * [RandomAccessFile.close] method.
332 * 379 *
333 * Files can be opened in three modes: 380 * Files can be opened in three modes:
334 * 381 *
335 * [FileMode.READ]: open the file for reading. 382 * [FileMode.READ]: open the file for reading.
336 * 383 *
337 * [FileMode.WRITE]: open the file for both reading and writing and 384 * [FileMode.WRITE]: open the file for both reading and writing and
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 sb.write(": $osError"); 937 sb.write(": $osError");
891 if (path != null) { 938 if (path != null) {
892 sb.write(", path = '$path'"); 939 sb.write(", path = '$path'");
893 } 940 }
894 } else if (path != null) { 941 } else if (path != null) {
895 sb.write(": $path"); 942 sb.write(": $path");
896 } 943 }
897 return sb.toString(); 944 return sb.toString();
898 } 945 }
899 } 946 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698