Visit Mozilla.org

nsIFile:create

From MDC

« XPCOM API Reference

Contents

[edit] Summary

This method creates a new file or directory corresponding to the file path represented by this nsIFile.

 void create(
   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_ALREADY_EXISTS
Indicates that the file or directory already exists.
NS_ERROR_FILE_UNKNOWN_TYPE
Indicates that the value of aType does not correspond to a known type.

[edit] Remarks

This method will create any path segments that do not already exist.