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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/file.dart
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index cb9cdcc8e80fbc45af9bd8d340d632d7b0a5ccee..9793cc7ffd5bc48fc9c276e4cd110b54e0766961 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -310,14 +310,45 @@ abstract class File implements FileSystemEntity {
File get absolute;
/**
- * Get the last-modified time of the file. Returns a
+ * Gets the last-accessed time of the file. Returns a
+ * [: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.
+ * access date.
+ */
+ 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.
+
+ /**
+ * Gets the last-accessed time of the file. Throws an exception
+ * if the file does not exist.
+ *
+ * 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.
+ */
+ DateTime lastAccessedSync();
+
+ /**
+ * Modifies the time the file was last accessed.
+ *
+ * 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.
+ * [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.
+ * cannot be set, the future completes with an exception.
+ */
+ 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.
+
+ /**
+ * Synchronously modifies the time the file was last accessed.
+ *
+ * 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.
+ */
+ File setLastAccessedSync(DateTime time);
Lasse Reichstein Nielsen 2017/02/09 15:28:03 Return void.
zra 2017/02/09 17:21:38 Done.
+
+ /**
+ * Gets the last-modified time of the file. Returns a
* [:Future<DateTime>:] that completes with a [DateTime] object for the
* modification date.
*/
Future<DateTime> lastModified();
/**
- * Get the last-modified time of the file. Throws an exception
+ * Gets the last-modified time of the file. Throws an exception
* if the file does not exist.
*
* Throws a [FileSystemException] if the operation fails.
@@ -325,6 +356,22 @@ abstract class File implements FileSystemEntity {
DateTime lastModifiedSync();
/**
+ * Modifies the time the file was last modified.
+ *
+ * Returns a [:Future<File>:] that completes with this
+ * [File] when the attributes have been set. If the modification
+ * time cannot be set, the future completes with an exception.
+ */
+ 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.
+
+ /**
+ * Synchronously modifies the time the file was last modified.
+ *
+ * If the attributes cannot be set, throws a [FileSystemException].
+ */
+ 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.
+
+ /**
* Open the file for random access operations. Returns a
* [:Future<RandomAccessFile>:] that completes with the opened
* random access file. [RandomAccessFile]s must be closed using the

Powered by Google App Engine
This is Rietveld 408576698