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

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

Issue 25279003: dart:io | Add Directory.CreateSystemTemp(template) and change Directory.CreateTemp(template). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add check of "TMP" environment variable if "TMPDIR" is missing. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * A reference to a directory (or _folder_) on the file system. 8 * A reference to a directory (or _folder_) on the file system.
9 */ 9 */
10 abstract class Directory implements FileSystemEntity { 10 abstract class Directory implements FileSystemEntity {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 * 61 *
62 * If [recursive] is false, only the last directory in the path is 62 * If [recursive] is false, only the last directory in the path is
63 * created. If [recursive] is true, all non-existing path components 63 * created. If [recursive] is true, all non-existing path components
64 * are created. If the directory already exists nothing is done. 64 * are created. If the directory already exists nothing is done.
65 * 65 *
66 * If the directory cannot be created an exception is thrown. 66 * If the directory cannot be created an exception is thrown.
67 */ 67 */
68 void createSync({bool recursive: false}); 68 void createSync({bool recursive: false});
69 69
70 /** 70 /**
71 * Creates a temporary directory with a name based on the current 71 * Creates a temporary directory in this directory. Additional random
72 * path. The path is used as a template, and additional 72 * characters are appended to [template] to produce a unique directory
73 * characters are appended to it to make a unique temporary 73 * name.
74 * directory name. If the path is the empty string, a default 74 *
75 * system temp directory and name are used for the template. 75 * Returns a [:Future<Directory>:] that completes with the newly
76 * created temporary directory.
77 *
78 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the
79 * empty string, the directory is created in the default system temp
80 * directory. This capability has been moved to the static function
81 * [createSystemTemp].
82 */
83 Future<Directory> createTemp([String template]);
84
85 /**
86 * Synchronously creates a temporary directory in this directory.
87 * Additional random characters are appended to [template] to produce
88 * a unique directory name.
89 *
90 * Returns the newly created temporary directory.
91 *
92 * Deprecated behavior, to be removed Oct 18, 2013: If the path is the
93 * empty string, the directory is created in the default system temp
94 * directory. This capability has been moved to the static function
95 * [createSystemTemp].
96 */
97 Directory createTempSync([String template]);
98
99 /**
100 * Creates a temporary directory in the system temp directory.
101 * The location of the system temp directory is platform-dependent,
102 * and may be set by an environment variable.
103 * Additional random characters are appended to [template] to produce
104 * a unique directory name.
76 * 105 *
77 * Returns a [:Future<Directory>:] that completes with the newly 106 * Returns a [:Future<Directory>:] that completes with the newly
78 * created temporary directory. 107 * created temporary directory.
79 */ 108 */
80 Future<Directory> createTemp(); 109 static Future<Directory> createSystemTemp([String template]) =>
110 _Directory.createSystemTemp(template);
81 111
82 /** 112 /**
83 * Synchronously creates a temporary directory with a name based on the 113 * Synchronously creates a temporary directory in the system temp directory.
84 * current path. The path is used as a template, and additional 114 * The location of the system temp directory is platform-dependent,
85 * characters are appended to it to make a unique temporary directory name. 115 * and may be set by an environment variable.
86 * If the path is the empty string, a default system temp directory and name 116 * Additional random characters are appended to [template] to produce
87 * are used for the template. Returns the newly created temporary directory. 117 * a unique directory name.
118 *
119 * Returns a [:Future<Directory>:] that completes with the newly
120 * created temporary directory.
88 */ 121 */
89 Directory createTempSync(); 122 static Directory createSystemTempSync([String template]) =>
123 _Directory.createSystemTempSync(template);
90 124
91 Future<String> resolveSymbolicLinks(); 125 Future<String> resolveSymbolicLinks();
92 126
93 String resolveSymbolicLinksSync(); 127 String resolveSymbolicLinksSync();
94 128
95 /** 129 /**
96 * Renames this directory. Returns a [:Future<Directory>:] that completes 130 * Renames this directory. Returns a [:Future<Directory>:] that completes
97 * with a [Directory] instance for the renamed directory. 131 * with a [Directory] instance for the renamed directory.
98 * 132 *
99 * If newPath identifies an existing directory, that directory is 133 * If newPath identifies an existing directory, that directory is
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (path != null) { 233 if (path != null) {
200 sb.write(", path = $path"); 234 sb.write(", path = $path");
201 } 235 }
202 } 236 }
203 return sb.toString(); 237 return sb.toString();
204 } 238 }
205 final String message; 239 final String message;
206 final String path; 240 final String path;
207 final OSError osError; 241 final OSError osError;
208 } 242 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698