You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.
nsILocalFile
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 asnsIFile
.Initializes 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.
Syntax:
void nsIFile::initWithPath(in AString filePath) [noscript] void nsILocalFile::initWithNativePath( in ACString filePath)Parameters:
filePath
: A string which specifies a full file path to a location. Relative paths will be treated as an error (NS_ERROR_FILE_UNRECOGNIZED_PATH
). ForinitWithNativePath
, thefilePath
must be in the native filesystem charset.
nsresult:
Initializes this object with another file.
Syntax:
void nsILocalFile::initWithFile(in nsILocalFile aFile)Parameters:
nsresult:
Opens the NSPR file descriptor. This method is not scriptable.
Syntax:
[noscript]PRFileDescStar nsILocalFile::openNSPRFileDesc( in long flags, in long mode)Parameters:
Returns:
Opens the ANSI file descriptor. This method is not scriptable.
Syntax:
[noscript] FILE nsILocalFile::openANSIFileDesc( in string mode)Parameters:
Returns:
Loads
this
file (a library). This method is not scriptable.Syntax:
[noscript] PRLibraryStar nsILocalFile::load()Parameters:
Returns:
Appends a relative path to the current path of the
nsILocalFile
object.Syntax:
void nsILocalFile::appendRelativePath( in AString relativeFilePath) [noscript]void nsILocalFile::appendRelativeNativePath( in ACString relativeFilePath)Parameters:
relativeFilePath
: The relative file path. It is a native relative path. For security reasons, it cannot contain .. or start with a directory separator. For theappendRelativeNativePath
method,relativeFilePath
must be in the native filesystem charset.
nsresult:
Asks 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.
Syntax:
void nsILocalFile::reveal()Parameters:
nsresult:
Asks the operating system to attempt to open the file. This really just simulates "double clicking" the file on your platform and thus only works on platforms which support this functionality.
Syntax:
void nsILocalFile::launch()Parameters:
nsresult:
Gets a relative file path in an opaque, XP format. It is therefore not a native path.
Note: The character set of the string returned from this function is undefined.
DO NOT TRY TO INTERPRET IT AS HUMAN READABLE TEXT!
Syntax:
ACString nsILocalFile::getRelativeDescriptor( in nsILocalFile fromFile)Parameters:
Returns:
Initializes the file to the location relative to
fromFile
using a string returned bygetRelativeDescriptor
.Syntax:
void nsILocalFile::setRelativeDescriptor( in nsILocalFile fromFile, in ACString relativeDesc)Parameters:
nsresult:
Gets and sets whether the
nsLocalFile
will auto resolve symbolic links. By default, this value will beFALSE
on all non Unix systems. On Unix, this attribute is effectively a no-op.Be aware that changing this attribute from
TRUE
toFALSE
after thensILocalFile
has been initialized may lead to errors. This could happen if there were resolved symlink in the initialized path. For example if you had /a/b/c where |b| was a symlink, and you change this attribute toFALSE
, the next usage would most likely fail.Gets and sets a
null
-terminated string which will specify the file in a persistent manner for disk storage.
Written by:Ellen Evans | Comments, questions, complaints?
Bug 143387 |