nsIFile:createUnique
From MDC
Contents |
[edit] Summary
This method creates a new, unique file or directory corresponding to the file path represented by this nsIFile.
void createUnique( in PRUint32 aType, in PRUint32 aPermissions );
[edit] Parameters
- aType
- [in] This parameter must be equal to one of the following values:
- nsIFile::NORMAL_FILE_TYPE - Specifies that a normal file should be created.
- nsIFile::DIRECTORY_TYPE - Specifies that a directory should be created.
- aPermissions
- [in] A UNIX-style file permissions value. For example, the octal value 0600 may be used to limit read and write access to the current user of the system. This parameter may be ignored on systems that do not support file permissions.
[edit] Exceptions Thrown
- NS_ERROR_FILE_UNKNOWN_TYPE
- Indicates that the value of aType does not correspond to a known type.
- NS_ERROR_FILE_TOO_BIG
- Indicates that the search for nonexistent files was unsuccessful because all of the attempted leaf name variants already exist.
[edit] Remarks
This method will create any path segments that do not already exist.
Unlike the create method, this method will never throw NS_ERROR_FILE_ALREADY_EXISTS. If the file already exists, then this method will vary the leaf name of the file path until a unique file path is generated.