Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | %{C++ |
michael@0 | 9 | struct PRFileDesc; |
michael@0 | 10 | struct PRLibrary; |
michael@0 | 11 | #include <stdio.h> |
michael@0 | 12 | %} |
michael@0 | 13 | |
michael@0 | 14 | [ptr] native PRFileDescStar(PRFileDesc); |
michael@0 | 15 | [ptr] native PRLibraryStar(PRLibrary); |
michael@0 | 16 | [ptr] native FILE(FILE); |
michael@0 | 17 | |
michael@0 | 18 | interface nsISimpleEnumerator; |
michael@0 | 19 | |
michael@0 | 20 | /** |
michael@0 | 21 | * An nsIFile is an abstract representation of a filename. It manages |
michael@0 | 22 | * filename encoding issues, pathname component separators ('/' vs. '\\' |
michael@0 | 23 | * vs. ':') and weird stuff like differing volumes with identical names, as |
michael@0 | 24 | * on pre-Darwin Macintoshes. |
michael@0 | 25 | * |
michael@0 | 26 | * This file has long introduced itself to new hackers with this opening |
michael@0 | 27 | * paragraph: |
michael@0 | 28 | * |
michael@0 | 29 | * This is the only correct cross-platform way to specify a file. |
michael@0 | 30 | * Strings are not such a way. If you grew up on windows or unix, you |
michael@0 | 31 | * may think they are. Welcome to reality. |
michael@0 | 32 | * |
michael@0 | 33 | * While taking the pose struck here to heart would be uncalled for, one |
michael@0 | 34 | * may safely conclude that writing cross-platform code is an embittering |
michael@0 | 35 | * experience. |
michael@0 | 36 | * |
michael@0 | 37 | * All methods with string parameters have two forms. The preferred |
michael@0 | 38 | * form operates on UCS-2 encoded characters strings. An alternate |
michael@0 | 39 | * form operates on characters strings encoded in the "native" charset. |
michael@0 | 40 | * |
michael@0 | 41 | * A string containing characters encoded in the native charset cannot |
michael@0 | 42 | * be safely passed to javascript via xpconnect. Therefore, the "native |
michael@0 | 43 | * methods" are not scriptable. |
michael@0 | 44 | */ |
michael@0 | 45 | [scriptable, uuid(a99a6a06-f90d-4659-8fce-c2f87feb1167), builtinclass] |
michael@0 | 46 | interface nsIFile : nsISupports |
michael@0 | 47 | { |
michael@0 | 48 | /** |
michael@0 | 49 | * Create Types |
michael@0 | 50 | * |
michael@0 | 51 | * NORMAL_FILE_TYPE - A normal file. |
michael@0 | 52 | * DIRECTORY_TYPE - A directory/folder. |
michael@0 | 53 | */ |
michael@0 | 54 | const unsigned long NORMAL_FILE_TYPE = 0; |
michael@0 | 55 | const unsigned long DIRECTORY_TYPE = 1; |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * append[Native] |
michael@0 | 59 | * |
michael@0 | 60 | * This function is used for constructing a descendent of the |
michael@0 | 61 | * current nsIFile. |
michael@0 | 62 | * |
michael@0 | 63 | * @param node |
michael@0 | 64 | * A string which is intended to be a child node of the nsIFile. |
michael@0 | 65 | * For the |appendNative| method, the node must be in the native |
michael@0 | 66 | * filesystem charset. |
michael@0 | 67 | */ |
michael@0 | 68 | void append(in AString node); |
michael@0 | 69 | [noscript] void appendNative(in ACString node); |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Normalize the pathName (e.g. removing .. and . components on Unix). |
michael@0 | 73 | */ |
michael@0 | 74 | void normalize(); |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * create |
michael@0 | 78 | * |
michael@0 | 79 | * This function will create a new file or directory in the |
michael@0 | 80 | * file system. Any nodes that have not been created or |
michael@0 | 81 | * resolved, will be. If the file or directory already |
michael@0 | 82 | * exists create() will return NS_ERROR_FILE_ALREADY_EXISTS. |
michael@0 | 83 | * |
michael@0 | 84 | * @param type |
michael@0 | 85 | * This specifies the type of file system object |
michael@0 | 86 | * to be made. The only two types at this time |
michael@0 | 87 | * are file and directory which are defined above. |
michael@0 | 88 | * If the type is unrecongnized, we will return an |
michael@0 | 89 | * error (NS_ERROR_FILE_UNKNOWN_TYPE). |
michael@0 | 90 | * |
michael@0 | 91 | * @param permissions |
michael@0 | 92 | * The unix style octal permissions. This may |
michael@0 | 93 | * be ignored on systems that do not need to do |
michael@0 | 94 | * permissions. |
michael@0 | 95 | */ |
michael@0 | 96 | void create(in unsigned long type, in unsigned long permissions); |
michael@0 | 97 | |
michael@0 | 98 | /** |
michael@0 | 99 | * Accessor to the leaf name of the file itself. |
michael@0 | 100 | * For the |nativeLeafName| method, the nativeLeafName must |
michael@0 | 101 | * be in the native filesystem charset. |
michael@0 | 102 | */ |
michael@0 | 103 | attribute AString leafName; |
michael@0 | 104 | [noscript] attribute ACString nativeLeafName; |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * copyTo[Native] |
michael@0 | 108 | * |
michael@0 | 109 | * This will copy this file to the specified newParentDir. |
michael@0 | 110 | * If a newName is specified, the file will be renamed. |
michael@0 | 111 | * If 'this' is not created we will return an error |
michael@0 | 112 | * (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST). |
michael@0 | 113 | * |
michael@0 | 114 | * copyTo may fail if the file already exists in the destination |
michael@0 | 115 | * directory. |
michael@0 | 116 | * |
michael@0 | 117 | * copyTo will NOT resolve aliases/shortcuts during the copy. |
michael@0 | 118 | * |
michael@0 | 119 | * @param newParentDir |
michael@0 | 120 | * This param is the destination directory. If the |
michael@0 | 121 | * newParentDir is null, copyTo() will use the parent |
michael@0 | 122 | * directory of this file. If the newParentDir is not |
michael@0 | 123 | * empty and is not a directory, an error will be |
michael@0 | 124 | * returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For the |
michael@0 | 125 | * |CopyToNative| method, the newName must be in the |
michael@0 | 126 | * native filesystem charset. |
michael@0 | 127 | * |
michael@0 | 128 | * @param newName |
michael@0 | 129 | * This param allows you to specify a new name for |
michael@0 | 130 | * the file to be copied. This param may be empty, in |
michael@0 | 131 | * which case the current leaf name will be used. |
michael@0 | 132 | */ |
michael@0 | 133 | void copyTo(in nsIFile newParentDir, in AString newName); |
michael@0 | 134 | [noscript] void CopyToNative(in nsIFile newParentDir, in ACString newName); |
michael@0 | 135 | |
michael@0 | 136 | /** |
michael@0 | 137 | * copyToFollowingLinks[Native] |
michael@0 | 138 | * |
michael@0 | 139 | * This function is identical to copyTo with the exception that, |
michael@0 | 140 | * as the name implies, it follows symbolic links. The XP_UNIX |
michael@0 | 141 | * implementation always follow symbolic links when copying. For |
michael@0 | 142 | * the |CopyToFollowingLinks| method, the newName must be in the |
michael@0 | 143 | * native filesystem charset. |
michael@0 | 144 | */ |
michael@0 | 145 | void copyToFollowingLinks(in nsIFile newParentDir, in AString newName); |
michael@0 | 146 | [noscript] void copyToFollowingLinksNative(in nsIFile newParentDir, in ACString newName); |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | * moveTo[Native] |
michael@0 | 150 | * |
michael@0 | 151 | * A method to move this file or directory to newParentDir. |
michael@0 | 152 | * If a newName is specified, the file or directory will be renamed. |
michael@0 | 153 | * If 'this' is not created we will return an error |
michael@0 | 154 | * (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST). |
michael@0 | 155 | * If 'this' is a file, and the destination file already exists, moveTo |
michael@0 | 156 | * will replace the old file. |
michael@0 | 157 | * This object is updated to refer to the new file. |
michael@0 | 158 | * |
michael@0 | 159 | * moveTo will NOT resolve aliases/shortcuts during the copy. |
michael@0 | 160 | * moveTo will do the right thing and allow copies across volumes. |
michael@0 | 161 | * moveTo will return an error (NS_ERROR_FILE_DIR_NOT_EMPTY) if 'this' is |
michael@0 | 162 | * a directory and the destination directory is not empty. |
michael@0 | 163 | * moveTo will return an error (NS_ERROR_FILE_ACCESS_DENIED) if 'this' is |
michael@0 | 164 | * a directory and the destination directory is not writable. |
michael@0 | 165 | * |
michael@0 | 166 | * @param newParentDir |
michael@0 | 167 | * This param is the destination directory. If the |
michael@0 | 168 | * newParentDir is empty, moveTo() will rename the file |
michael@0 | 169 | * within its current directory. If the newParentDir is |
michael@0 | 170 | * not empty and does not name a directory, an error will |
michael@0 | 171 | * be returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For |
michael@0 | 172 | * the |moveToNative| method, the newName must be in the |
michael@0 | 173 | * native filesystem charset. |
michael@0 | 174 | * |
michael@0 | 175 | * @param newName |
michael@0 | 176 | * This param allows you to specify a new name for |
michael@0 | 177 | * the file to be moved. This param may be empty, in |
michael@0 | 178 | * which case the current leaf name will be used. |
michael@0 | 179 | */ |
michael@0 | 180 | void moveTo(in nsIFile newParentDir, in AString newName); |
michael@0 | 181 | [noscript] void moveToNative(in nsIFile newParentDir, in ACString newName); |
michael@0 | 182 | |
michael@0 | 183 | /** |
michael@0 | 184 | * renameTo |
michael@0 | 185 | * |
michael@0 | 186 | * This method is identical to moveTo except that if this file or directory |
michael@0 | 187 | * is moved to a a different volume, it fails and returns an error |
michael@0 | 188 | * (NS_ERROR_FILE_ACCESS_DENIED). |
michael@0 | 189 | * This object will still point to the old location after renaming. |
michael@0 | 190 | */ |
michael@0 | 191 | void renameTo(in nsIFile newParentDir, in AString newName); |
michael@0 | 192 | |
michael@0 | 193 | /** |
michael@0 | 194 | * This will try to delete this file. The 'recursive' flag |
michael@0 | 195 | * must be PR_TRUE to delete directories which are not empty. |
michael@0 | 196 | * |
michael@0 | 197 | * This will not resolve any symlinks. |
michael@0 | 198 | */ |
michael@0 | 199 | void remove(in boolean recursive); |
michael@0 | 200 | |
michael@0 | 201 | /** |
michael@0 | 202 | * Attributes of nsIFile. |
michael@0 | 203 | */ |
michael@0 | 204 | |
michael@0 | 205 | attribute unsigned long permissions; |
michael@0 | 206 | attribute unsigned long permissionsOfLink; |
michael@0 | 207 | |
michael@0 | 208 | /** |
michael@0 | 209 | * File Times are to be in milliseconds from |
michael@0 | 210 | * midnight (00:00:00), January 1, 1970 Greenwich Mean |
michael@0 | 211 | * Time (GMT). |
michael@0 | 212 | */ |
michael@0 | 213 | attribute PRTime lastModifiedTime; |
michael@0 | 214 | attribute PRTime lastModifiedTimeOfLink; |
michael@0 | 215 | |
michael@0 | 216 | /** |
michael@0 | 217 | * WARNING! On the Mac, getting/setting the file size with nsIFile |
michael@0 | 218 | * only deals with the size of the data fork. If you need to |
michael@0 | 219 | * know the size of the combined data and resource forks use the |
michael@0 | 220 | * GetFileSizeWithResFork() method defined on nsILocalFileMac. |
michael@0 | 221 | */ |
michael@0 | 222 | attribute int64_t fileSize; |
michael@0 | 223 | readonly attribute int64_t fileSizeOfLink; |
michael@0 | 224 | |
michael@0 | 225 | /** |
michael@0 | 226 | * target & path |
michael@0 | 227 | * |
michael@0 | 228 | * Accessor to the string path. The native version of these |
michael@0 | 229 | * strings are not guaranteed to be a usable path to pass to |
michael@0 | 230 | * NSPR or the C stdlib. There are problems that affect |
michael@0 | 231 | * platforms on which a path does not fully specify a file |
michael@0 | 232 | * because two volumes can have the same name (e.g., mac). |
michael@0 | 233 | * This is solved by holding "private", native data in the |
michael@0 | 234 | * nsIFile implementation. This native data is lost when |
michael@0 | 235 | * you convert to a string. |
michael@0 | 236 | * |
michael@0 | 237 | * DO NOT PASS TO USE WITH NSPR OR STDLIB! |
michael@0 | 238 | * |
michael@0 | 239 | * target |
michael@0 | 240 | * Find out what the symlink points at. Will give error |
michael@0 | 241 | * (NS_ERROR_FILE_INVALID_PATH) if not a symlink. |
michael@0 | 242 | * |
michael@0 | 243 | * path |
michael@0 | 244 | * Find out what the nsIFile points at. |
michael@0 | 245 | * |
michael@0 | 246 | * Note that the ACString attributes are returned in the |
michael@0 | 247 | * native filesystem charset. |
michael@0 | 248 | * |
michael@0 | 249 | */ |
michael@0 | 250 | readonly attribute AString target; |
michael@0 | 251 | [noscript] readonly attribute ACString nativeTarget; |
michael@0 | 252 | readonly attribute AString path; |
michael@0 | 253 | [noscript] readonly attribute ACString nativePath; |
michael@0 | 254 | |
michael@0 | 255 | boolean exists(); |
michael@0 | 256 | boolean isWritable(); |
michael@0 | 257 | boolean isReadable(); |
michael@0 | 258 | boolean isExecutable(); |
michael@0 | 259 | boolean isHidden(); |
michael@0 | 260 | boolean isDirectory(); |
michael@0 | 261 | boolean isFile(); |
michael@0 | 262 | boolean isSymlink(); |
michael@0 | 263 | /** |
michael@0 | 264 | * Not a regular file, not a directory, not a symlink. |
michael@0 | 265 | */ |
michael@0 | 266 | boolean isSpecial(); |
michael@0 | 267 | |
michael@0 | 268 | /** |
michael@0 | 269 | * createUnique |
michael@0 | 270 | * |
michael@0 | 271 | * This function will create a new file or directory in the |
michael@0 | 272 | * file system. Any nodes that have not been created or |
michael@0 | 273 | * resolved, will be. If this file already exists, we try |
michael@0 | 274 | * variations on the leaf name "suggestedName" until we find |
michael@0 | 275 | * one that did not already exist. |
michael@0 | 276 | * |
michael@0 | 277 | * If the search for nonexistent files takes too long |
michael@0 | 278 | * (thousands of the variants already exist), we give up and |
michael@0 | 279 | * return NS_ERROR_FILE_TOO_BIG. |
michael@0 | 280 | * |
michael@0 | 281 | * @param type |
michael@0 | 282 | * This specifies the type of file system object |
michael@0 | 283 | * to be made. The only two types at this time |
michael@0 | 284 | * are file and directory which are defined above. |
michael@0 | 285 | * If the type is unrecongnized, we will return an |
michael@0 | 286 | * error (NS_ERROR_FILE_UNKNOWN_TYPE). |
michael@0 | 287 | * |
michael@0 | 288 | * @param permissions |
michael@0 | 289 | * The unix style octal permissions. This may |
michael@0 | 290 | * be ignored on systems that do not need to do |
michael@0 | 291 | * permissions. |
michael@0 | 292 | */ |
michael@0 | 293 | void createUnique(in unsigned long type, in unsigned long permissions); |
michael@0 | 294 | |
michael@0 | 295 | /** |
michael@0 | 296 | * clone() |
michael@0 | 297 | * |
michael@0 | 298 | * This function will allocate and initialize a nsIFile object to the |
michael@0 | 299 | * exact location of the |this| nsIFile. |
michael@0 | 300 | * |
michael@0 | 301 | * @param file |
michael@0 | 302 | * A nsIFile which this object will be initialize |
michael@0 | 303 | * with. |
michael@0 | 304 | * |
michael@0 | 305 | */ |
michael@0 | 306 | nsIFile clone(); |
michael@0 | 307 | |
michael@0 | 308 | /** |
michael@0 | 309 | * Will determine if the inFile equals this. |
michael@0 | 310 | */ |
michael@0 | 311 | boolean equals(in nsIFile inFile); |
michael@0 | 312 | |
michael@0 | 313 | /** |
michael@0 | 314 | * Will determine if inFile is a descendant of this file |
michael@0 | 315 | * If |recur| is true, look in subdirectories too |
michael@0 | 316 | */ |
michael@0 | 317 | boolean contains(in nsIFile inFile, in boolean recur); |
michael@0 | 318 | |
michael@0 | 319 | /** |
michael@0 | 320 | * Parent will be null when this is at the top of the volume. |
michael@0 | 321 | */ |
michael@0 | 322 | readonly attribute nsIFile parent; |
michael@0 | 323 | |
michael@0 | 324 | /** |
michael@0 | 325 | * Returns an enumeration of the elements in a directory. Each |
michael@0 | 326 | * element in the enumeration is an nsIFile. |
michael@0 | 327 | * |
michael@0 | 328 | * @throws NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does |
michael@0 | 329 | * not specify a directory. |
michael@0 | 330 | */ |
michael@0 | 331 | readonly attribute nsISimpleEnumerator directoryEntries; |
michael@0 | 332 | |
michael@0 | 333 | /** |
michael@0 | 334 | * initWith[Native]Path |
michael@0 | 335 | * |
michael@0 | 336 | * This function will initialize the nsIFile object. Any |
michael@0 | 337 | * internal state information will be reset. |
michael@0 | 338 | * |
michael@0 | 339 | * @param filePath |
michael@0 | 340 | * A string which specifies a full file path to a |
michael@0 | 341 | * location. Relative paths will be treated as an |
michael@0 | 342 | * error (NS_ERROR_FILE_UNRECOGNIZED_PATH). For |
michael@0 | 343 | * initWithNativePath, the filePath must be in the native |
michael@0 | 344 | * filesystem charset. |
michael@0 | 345 | */ |
michael@0 | 346 | void initWithPath(in AString filePath); |
michael@0 | 347 | [noscript] void initWithNativePath(in ACString filePath); |
michael@0 | 348 | |
michael@0 | 349 | /** |
michael@0 | 350 | * initWithFile |
michael@0 | 351 | * |
michael@0 | 352 | * Initialize this object with another file |
michael@0 | 353 | * |
michael@0 | 354 | * @param aFile |
michael@0 | 355 | * the file this becomes equivalent to |
michael@0 | 356 | */ |
michael@0 | 357 | void initWithFile(in nsIFile aFile); |
michael@0 | 358 | |
michael@0 | 359 | /** |
michael@0 | 360 | * followLinks |
michael@0 | 361 | * |
michael@0 | 362 | * This attribute will determine if the nsLocalFile will auto |
michael@0 | 363 | * resolve symbolic links. By default, this value will be false |
michael@0 | 364 | * on all non unix systems. On unix, this attribute is effectively |
michael@0 | 365 | * a noop. |
michael@0 | 366 | */ |
michael@0 | 367 | attribute boolean followLinks; |
michael@0 | 368 | |
michael@0 | 369 | /** |
michael@0 | 370 | * Flag for openNSPRFileDesc(), to hint to the OS that the file will be |
michael@0 | 371 | * read sequentially with agressive readahead. |
michael@0 | 372 | */ |
michael@0 | 373 | const unsigned long OS_READAHEAD = 0x40000000; |
michael@0 | 374 | |
michael@0 | 375 | /** |
michael@0 | 376 | * Flag for openNSPRFileDesc(). Deprecated and unreliable! |
michael@0 | 377 | * Instead use NS_OpenAnonymousTemporaryFile() to create a temporary |
michael@0 | 378 | * file which will be deleted upon close! |
michael@0 | 379 | */ |
michael@0 | 380 | const unsigned long DELETE_ON_CLOSE = 0x80000000; |
michael@0 | 381 | |
michael@0 | 382 | /** |
michael@0 | 383 | * Return the result of PR_Open on the file. The caller is |
michael@0 | 384 | * responsible for calling PR_Close on the result. |
michael@0 | 385 | * |
michael@0 | 386 | * @param flags the PR_Open flags from prio.h, plus optionally |
michael@0 | 387 | * OS_READAHEAD or DELETE_ON_CLOSE. OS_READAHEAD is a hint to the |
michael@0 | 388 | * OS that the file will be read sequentially with agressive |
michael@0 | 389 | * readahead. DELETE_ON_CLOSE is unreliable on Windows and is deprecated. |
michael@0 | 390 | * Instead use NS_OpenAnonymousTemporaryFile() to create a temporary |
michael@0 | 391 | * file which will be deleted upon close. |
michael@0 | 392 | */ |
michael@0 | 393 | [noscript] PRFileDescStar openNSPRFileDesc(in long flags, in long mode); |
michael@0 | 394 | |
michael@0 | 395 | /** |
michael@0 | 396 | * Return the result of fopen on the file. The caller is |
michael@0 | 397 | * responsible for calling fclose on the result. |
michael@0 | 398 | */ |
michael@0 | 399 | [noscript] FILE openANSIFileDesc(in string mode); |
michael@0 | 400 | |
michael@0 | 401 | /** |
michael@0 | 402 | * Return the result of PR_LoadLibrary on the file. The caller is |
michael@0 | 403 | * responsible for calling PR_UnloadLibrary on the result. |
michael@0 | 404 | */ |
michael@0 | 405 | [noscript] PRLibraryStar load(); |
michael@0 | 406 | |
michael@0 | 407 | // number of bytes available on disk to non-superuser |
michael@0 | 408 | readonly attribute int64_t diskSpaceAvailable; |
michael@0 | 409 | |
michael@0 | 410 | /** |
michael@0 | 411 | * appendRelative[Native]Path |
michael@0 | 412 | * |
michael@0 | 413 | * Append a relative path to the current path of the nsIFile object. |
michael@0 | 414 | * |
michael@0 | 415 | * @param relativeFilePath |
michael@0 | 416 | * relativeFilePath is a native relative path. For security reasons, |
michael@0 | 417 | * this cannot contain .. or cannot start with a directory separator. |
michael@0 | 418 | * For the |appendRelativeNativePath| method, the relativeFilePath |
michael@0 | 419 | * must be in the native filesystem charset. |
michael@0 | 420 | */ |
michael@0 | 421 | void appendRelativePath(in AString relativeFilePath); |
michael@0 | 422 | [noscript] void appendRelativeNativePath(in ACString relativeFilePath); |
michael@0 | 423 | |
michael@0 | 424 | /** |
michael@0 | 425 | * Accessor to a null terminated string which will specify |
michael@0 | 426 | * the file in a persistent manner for disk storage. |
michael@0 | 427 | * |
michael@0 | 428 | * The character set of this attribute is undefined. DO NOT TRY TO |
michael@0 | 429 | * INTERPRET IT AS HUMAN READABLE TEXT! |
michael@0 | 430 | */ |
michael@0 | 431 | attribute ACString persistentDescriptor; |
michael@0 | 432 | |
michael@0 | 433 | /** |
michael@0 | 434 | * reveal |
michael@0 | 435 | * |
michael@0 | 436 | * Ask the operating system to open the folder which contains |
michael@0 | 437 | * this file or folder. This routine only works on platforms which |
michael@0 | 438 | * support the ability to open a folder and is run async on Windows. |
michael@0 | 439 | * This routine must be called on the main. |
michael@0 | 440 | */ |
michael@0 | 441 | void reveal(); |
michael@0 | 442 | |
michael@0 | 443 | /** |
michael@0 | 444 | * launch |
michael@0 | 445 | * |
michael@0 | 446 | * Ask the operating system to attempt to open the file. |
michael@0 | 447 | * this really just simulates "double clicking" the file on your platform. |
michael@0 | 448 | * This routine only works on platforms which support this functionality |
michael@0 | 449 | * and is run async on Windows. This routine must be called on the |
michael@0 | 450 | * main thread. |
michael@0 | 451 | */ |
michael@0 | 452 | void launch(); |
michael@0 | 453 | |
michael@0 | 454 | /** |
michael@0 | 455 | * getRelativeDescriptor |
michael@0 | 456 | * |
michael@0 | 457 | * Returns a relative file path in an opaque, XP format. It is therefore |
michael@0 | 458 | * not a native path. |
michael@0 | 459 | * |
michael@0 | 460 | * The character set of the string returned from this function is |
michael@0 | 461 | * undefined. DO NOT TRY TO INTERPRET IT AS HUMAN READABLE TEXT! |
michael@0 | 462 | * |
michael@0 | 463 | * @param fromFile |
michael@0 | 464 | * the file from which the descriptor is relative. |
michael@0 | 465 | * There is no defined result if this param is null. |
michael@0 | 466 | */ |
michael@0 | 467 | ACString getRelativeDescriptor(in nsIFile fromFile); |
michael@0 | 468 | |
michael@0 | 469 | /** |
michael@0 | 470 | * setRelativeDescriptor |
michael@0 | 471 | * |
michael@0 | 472 | * Initializes the file to the location relative to fromFile using |
michael@0 | 473 | * a string returned by getRelativeDescriptor. |
michael@0 | 474 | * |
michael@0 | 475 | * @param fromFile |
michael@0 | 476 | * the file to which the descriptor is relative |
michael@0 | 477 | * @param relative |
michael@0 | 478 | * the relative descriptor obtained from getRelativeDescriptor |
michael@0 | 479 | */ |
michael@0 | 480 | void setRelativeDescriptor(in nsIFile fromFile, in ACString relativeDesc); |
michael@0 | 481 | }; |
michael@0 | 482 | |
michael@0 | 483 | %{C++ |
michael@0 | 484 | #ifdef MOZILLA_INTERNAL_API |
michael@0 | 485 | #include "nsDirectoryServiceUtils.h" |
michael@0 | 486 | #endif |
michael@0 | 487 | %} |