Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsILocalFile Interface Reference

This interface adds methods to nsIFile that are particular to a file that is accessible via the local file system. More...

import "nsILocalFile.idl";

Inheritance diagram for nsILocalFile:
Inheritance graph
[legend]
Collaboration diagram for nsILocalFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void initWithPath (in AString filePath)
 initWith[Native]Path
void initWithNativePath (in ACString filePath)
void initWithFile (in nsILocalFile aFile)
 initWithFile
PRFileDescStar openNSPRFileDesc (in long flags, in long mode)
FILE openANSIFileDesc (in string mode)
PRLibraryStar load ()
void appendRelativePath (in AString relativeFilePath)
 appendRelative[Native]Path
void appendRelativeNativePath (in ACString relativeFilePath)
void reveal ()
 reveal
void launch ()
 launch
ACString getRelativeDescriptor (in nsILocalFile fromFile)
 getRelativeDescriptor
void setRelativeDescriptor (in nsILocalFile fromFile, in ACString relativeDesc)
 setRelativeDescriptor
void append (in AString node)
 append[Native]
void appendNative (in ACString node)
void normalize ()
 Normalize the pathName (e.g.
void create (in unsigned long type, in unsigned long permissions)
 create
void copyTo (in nsIFile newParentDir, in AString newName)
 copyTo[Native]
void CopyToNative (in nsIFile newParentDir, in ACString newName)
void copyToFollowingLinks (in nsIFile newParentDir, in AString newName)
 copyToFollowingLinks[Native]
void copyToFollowingLinksNative (in nsIFile newParentDir, in ACString newName)
void moveTo (in nsIFile newParentDir, in AString newName)
 moveTo[Native]
void moveToNative (in nsIFile newParentDir, in ACString newName)
void remove (in boolean recursive)
 This will try to delete this file.
boolean exists ()
boolean isWritable ()
boolean isReadable ()
boolean isExecutable ()
boolean isHidden ()
boolean isDirectory ()
boolean isFile ()
boolean isSymlink ()
boolean isSpecial ()
 Not a regular file, not a directory, not a symlink.
void createUnique (in unsigned long type, in unsigned long permissions)
 createUnique
nsIFile clone ()
 clone()
boolean equals (in nsIFile inFile)
 Will determine if the inFile equals this.
boolean contains (in nsIFile inFile, in boolean recur)
 Will determine if inFile is a descendant of this file If |recur| is true, look in subdirectories too.

Public Attributes

attribute PRBool followLinks
 followLinks
readonly attribute PRInt64 diskSpaceAvailable
attribute ACString persistentDescriptor
 Accessor to a null terminated string which will specify the file in a persistent manner for disk storage.
const unsigned long NORMAL_FILE_TYPE = 0
 Create Types.
const unsigned long DIRECTORY_TYPE = 1
attribute AString leafName
 Accessor to the leaf name of the file itself.
attribute ACString nativeLeafName
attribute unsigned long permissions
 Attributes of nsIFile.
attribute unsigned long permissionsOfLink
attribute PRInt64 lastModifiedTime
 File Times are to be in milliseconds from midnight (00:00:00), January 1, 1970 Greenwich Mean Time (GMT).
attribute PRInt64 lastModifiedTimeOfLink
attribute PRInt64 fileSize
 WARNING! On the Mac, getting/setting the file size with nsIFile only deals with the size of the data fork.
readonly attribute PRInt64 fileSizeOfLink
readonly attribute AString target
 target & path
readonly attribute ACString nativeTarget
readonly attribute AString path
readonly attribute ACString nativePath
readonly attribute nsIFile parent
 Parent will be null when this is at the top of the volume.
readonly attribute
nsISimpleEnumerator 
directoryEntries
 Returns an enumeration of the elements in a directory.

Detailed Description

This interface adds methods to nsIFile that are particular to a file that is accessible via the local file system.

It follows the same string conventions as nsIFile.

FROZEN

Definition at line 62 of file nsILocalFile.idl.


Member Function Documentation

void nsIFile::append ( in AString  node) [inherited]

append[Native]

This function is used for constructing a descendent of the current nsIFile.

Parameters:
nodeA string which is intended to be a child node of the nsIFile. For the |appendNative| method, the node must be in the native filesystem charset.
void nsIFile::appendNative ( in ACString  node) [inherited]
void nsILocalFile::appendRelativeNativePath ( in ACString  relativeFilePath)
void nsILocalFile::appendRelativePath ( in AString  relativeFilePath)

appendRelative[Native]Path

Append a relative path to the current path of the nsILocalFile object.

Parameters:
relativeFilePathrelativeFilePath is a native relative path. For security reasons, this cannot contain .. or cannot start with a directory separator. For the |appendRelativeNativePath| method, the relativeFilePath must be in the native filesystem charset.
nsIFile nsIFile::clone ( ) [inherited]

clone()

This function will allocate and initialize a nsIFile object to the exact location of the |this| nsIFile.

Parameters:
fileA nsIFile which this object will be initialize with.
boolean nsIFile::contains ( in nsIFile  inFile,
in boolean  recur 
) [inherited]

Will determine if inFile is a descendant of this file If |recur| is true, look in subdirectories too.

void nsIFile::copyTo ( in nsIFile  newParentDir,
in AString  newName 
) [inherited]

copyTo[Native]

This will copy this file to the specified newParentDir. If a newName is specified, the file will be renamed. If 'this' is not created we will return an error (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST).

copyTo may fail if the file already exists in the destination directory.

copyTo will NOT resolve aliases/shortcuts during the copy.

Parameters:
newParentDirThis param is the destination directory. If the newParentDir is null, copyTo() will use the parent directory of this file. If the newParentDir is not empty and is not a directory, an error will be returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For the |CopyToNative| method, the newName must be in the native filesystem charset.
newNameThis param allows you to specify a new name for the file to be copied. This param may be empty, in which case the current leaf name will be used.
void nsIFile::copyToFollowingLinks ( in nsIFile  newParentDir,
in AString  newName 
) [inherited]

copyToFollowingLinks[Native]

This function is identical to copyTo with the exception that, as the name implies, it follows symbolic links. The XP_UNIX implementation always follow symbolic links when copying. For the |CopyToFollowingLinks| method, the newName must be in the native filesystem charset.

void nsIFile::copyToFollowingLinksNative ( in nsIFile  newParentDir,
in ACString  newName 
) [inherited]
void nsIFile::CopyToNative ( in nsIFile  newParentDir,
in ACString  newName 
) [inherited]

Here is the caller graph for this function:

void nsIFile::create ( in unsigned long  type,
in unsigned long  permissions 
) [inherited]

create

This function will create a new file or directory in the file system. Any nodes that have not been created or resolved, will be. If the file or directory already exists create() will return NS_ERROR_FILE_ALREADY_EXISTS.

Parameters:
typeThis specifies the type of file system object to be made. The only two types at this time are file and directory which are defined above. If the type is unrecongnized, we will return an error (NS_ERROR_FILE_UNKNOWN_TYPE).
permissionsThe unix style octal permissions. This may be ignored on systems that do not need to do permissions.
void nsIFile::createUnique ( in unsigned long  type,
in unsigned long  permissions 
) [inherited]

createUnique

This function will create a new file or directory in the file system. Any nodes that have not been created or resolved, will be. If this file already exists, we try variations on the leaf name "suggestedName" until we find one that did not already exist.

If the search for nonexistent files takes too long (thousands of the variants already exist), we give up and return NS_ERROR_FILE_TOO_BIG.

Parameters:
typeThis specifies the type of file system object to be made. The only two types at this time are file and directory which are defined above. If the type is unrecongnized, we will return an error (NS_ERROR_FILE_UNKNOWN_TYPE).
permissionsThe unix style octal permissions. This may be ignored on systems that do not need to do permissions.
boolean nsIFile::equals ( in nsIFile  inFile) [inherited]

Will determine if the inFile equals this.

boolean nsIFile::exists ( ) [inherited]

Here is the caller graph for this function:

getRelativeDescriptor

Returns a relative file path in an opaque, XP format. It is therefore not a native path.

The character set of the string returned from this function is undefined. DO NOT TRY TO INTERPRET IT AS HUMAN READABLE TEXT!

Parameters:
fromFilethe file from which the descriptor is relative. There is no defined result if this param is null.

initWithFile

Initialize this object with another file

Parameters:
aFilethe file this becomes equivalent to
void nsILocalFile::initWithNativePath ( in ACString  filePath)
void nsILocalFile::initWithPath ( in AString  filePath)

initWith[Native]Path

This function will initialize the nsILocalFile object. Any internal state information will be reset.

NOTE: This function has a known bug on the macintosh and other OSes which do not represent file locations as paths. If you do use this function, be very aware of this problem!

Parameters:
filePathA string which specifies a full file path to a location. Relative paths will be treated as an error (NS_ERROR_FILE_UNRECOGNIZED_PATH). For initWithNativePath, the filePath must be in the native filesystem charset.
boolean nsIFile::isDirectory ( ) [inherited]
boolean nsIFile::isExecutable ( ) [inherited]
boolean nsIFile::isFile ( ) [inherited]
boolean nsIFile::isHidden ( ) [inherited]
boolean nsIFile::isReadable ( ) [inherited]
boolean nsIFile::isSpecial ( ) [inherited]

Not a regular file, not a directory, not a symlink.

boolean nsIFile::isSymlink ( ) [inherited]
boolean nsIFile::isWritable ( ) [inherited]

Here is the caller graph for this function:

launch

Ask the operating system to attempt to open the file. this really just simulates "double clicking" the file on your platform. This routine only works on platforms which support this functionality.

void nsIFile::moveTo ( in nsIFile  newParentDir,
in AString  newName 
) [inherited]

moveTo[Native]

A method to move this file or directory to newParentDir. If a newName is specified, the file or directory will be renamed. If 'this' is not created we will return an error (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST). If 'this' is a file, and the destination file already exists, moveTo will replace the old file.

moveTo will NOT resolve aliases/shortcuts during the copy. moveTo will do the right thing and allow copies across volumes. moveTo will return an error (NS_ERROR_FILE_DIR_NOT_EMPTY) if 'this' is a directory and the destination directory is not empty. moveTo will return an error (NS_ERROR_FILE_ACCESS_DENIED) if 'this' is a directory and the destination directory is not writable.

Parameters:
newParentDirThis param is the destination directory. If the newParentDir is empty, moveTo() will rename the file within its current directory. If the newParentDir is not empty and does not name a directory, an error will be returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For the |moveToNative| method, the newName must be in the native filesystem charset.
newNameThis param allows you to specify a new name for the file to be moved. This param may be empty, in which case the current leaf name will be used.
void nsIFile::moveToNative ( in nsIFile  newParentDir,
in ACString  newName 
) [inherited]
void nsIFile::normalize ( ) [inherited]

Normalize the pathName (e.g.

removing .. and . components on Unix).

void nsIFile::remove ( in boolean  recursive) [inherited]

This will try to delete this file.

The 'recursive' flag must be PR_TRUE to delete directories which are not empty.

This will not resolve any symlinks.

reveal

Ask the operating system to open the folder which contains this file or folder. This routine only works on platforms which support the ability to open a folder...

void nsILocalFile::setRelativeDescriptor ( in nsILocalFile  fromFile,
in ACString  relativeDesc 
)

setRelativeDescriptor

Initializes the file to the location relative to fromFile using a string returned by getRelativeDescriptor.

Parameters:
fromFilethe file to which the descriptor is relative
relativethe relative descriptor obtained from getRelativeDescriptor

Member Data Documentation

const unsigned long nsIFile::DIRECTORY_TYPE = 1 [inherited]

Definition at line 71 of file nsIFile.idl.

Returns an enumeration of the elements in a directory.

Each element in the enumeration is an nsIFile.

Returns:
NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does not specify a directory.

Definition at line 336 of file nsIFile.idl.

Definition at line 109 of file nsILocalFile.idl.

WARNING! On the Mac, getting/setting the file size with nsIFile only deals with the size of the data fork.

If you need to know the size of the combined data and resource forks use the GetFileSizeWithResFork() method defined on nsILocalFileMac.

Definition at line 227 of file nsIFile.idl.

Definition at line 228 of file nsIFile.idl.

followLinks

This attribute will determine if the nsLocalFile will auto resolve symbolic links. By default, this value will be false on all non unix systems. On unix, this attribute is effectively a noop.

Definition at line 102 of file nsILocalFile.idl.

File Times are to be in milliseconds from midnight (00:00:00), January 1, 1970 Greenwich Mean Time (GMT).

Definition at line 218 of file nsIFile.idl.

Definition at line 219 of file nsIFile.idl.

attribute AString nsIFile::leafName [inherited]

Accessor to the leaf name of the file itself.

For the |nativeLeafName| method, the nativeLeafName must be in the native filesystem charset.

Definition at line 119 of file nsIFile.idl.

attribute ACString nsIFile::nativeLeafName [inherited]

Definition at line 120 of file nsIFile.idl.

readonly attribute ACString nsIFile::nativePath [inherited]

Definition at line 258 of file nsIFile.idl.

readonly attribute ACString nsIFile::nativeTarget [inherited]

Definition at line 256 of file nsIFile.idl.

const unsigned long nsIFile::NORMAL_FILE_TYPE = 0 [inherited]

Create Types.

NORMAL_FILE_TYPE - A normal file. DIRECTORY_TYPE - A directory/folder.

Definition at line 70 of file nsIFile.idl.

readonly attribute nsIFile nsIFile::parent [inherited]

Parent will be null when this is at the top of the volume.

Definition at line 327 of file nsIFile.idl.

readonly attribute AString nsIFile::path [inherited]

Definition at line 257 of file nsIFile.idl.

attribute unsigned long nsIFile::permissions [inherited]

Attributes of nsIFile.

Definition at line 210 of file nsIFile.idl.

Definition at line 211 of file nsIFile.idl.

Accessor to a null terminated string which will specify the file in a persistent manner for disk storage.

The character set of this attribute is undefined. DO NOT TRY TO INTERPRET IT AS HUMAN READABLE TEXT!

Definition at line 132 of file nsILocalFile.idl.

readonly attribute AString nsIFile::target [inherited]

target & path

Accessor to the string path. The native version of these strings are not guaranteed to be a usable path to pass to NSPR or the C stdlib. There are problems that affect platforms on which a path does not fully specify a file because two volumes can have the same name (e.g., XP_MAC). This is solved by holding "private", native data in the nsIFile implementation. This native data is lost when you convert to a string.

DO NOT PASS TO USE WITH NSPR OR STDLIB!

target Find out what the symlink points at. Will give error (NS_ERROR_FILE_INVALID_PATH) if not a symlink.

path Find out what the nsIFile points at.

Note that the ACString attributes are returned in the native filesystem charset.

Definition at line 255 of file nsIFile.idl.


The documentation for this interface was generated from the following file: