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

Unified Diff: sdk/lib/io/file.dart

Issue 2681683005: [dart:io] Adds functions to set file access and modification time (Closed)
Patch Set: Fuchsia cleanup 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..7d4c97d5fcc40cb66b936513d3e3143a62bebe5f 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
+ * access date.
+ */
+ Future<DateTime> lastAccessed();
+
+ /**
+ * Gets the last-accessed time of the file. Throws an exception
+ * if the file does not exist.
+ *
+ * Throws a [FileSystemException] if the operation fails.
+ */
+ DateTime lastAccessedSync();
+
+ /**
+ * Modifies the time the file was last accessed.
+ *
+ * Returns a [:Future<File>:] that completes with this
+ * [File] when the attributes have been set. If the access time
+ * cannot be set, the future completes with an exception.
+ */
+ Future<File> setLastAccessed(DateTime time);
+
+ /**
+ * Synchronously modifies the time the file was last accessed.
+ *
+ * If the attributes cannot be set, throws a [FileSystemException].
+ */
+ void setLastAccessedSync(DateTime time);
+
+ /**
+ * 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);
+
+ /**
+ * Synchronously modifies the time the file was last modified.
+ *
+ * If the attributes cannot be set, throws a [FileSystemException].
+ */
+ void setLastModifiedSync(DateTime time);
+
+ /**
* 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