2000-01-25 00:28:28 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
1999-12-02 10:45:12 +03:00
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code,
|
|
|
|
* released March 31, 1998.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Doug Turner <dougt@netscape.com>
|
2002-05-03 10:01:29 +04:00
|
|
|
* Darin Fisher <darin@netscape.com>
|
1999-12-02 10:45:12 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsIFile.idl"
|
|
|
|
|
1999-12-22 04:56:45 +03:00
|
|
|
%{C++
|
|
|
|
#include "prio.h"
|
1999-12-22 07:11:13 +03:00
|
|
|
#include "prlink.h"
|
2000-01-25 00:28:28 +03:00
|
|
|
#include <stdio.h>
|
2002-04-09 18:12:24 +04:00
|
|
|
#include "nsAString.h"
|
1999-12-22 04:56:45 +03:00
|
|
|
%}
|
|
|
|
|
|
|
|
[ptr] native PRFileDescStar(PRFileDesc);
|
1999-12-22 05:59:01 +03:00
|
|
|
[ptr] native PRLibraryStar(PRLibrary);
|
2000-01-25 00:28:28 +03:00
|
|
|
[ptr] native FILE(FILE);
|
1999-12-22 04:56:45 +03:00
|
|
|
|
2002-05-03 10:01:29 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2002-05-14 02:55:29 +04:00
|
|
|
* @status FROZEN
|
2002-05-03 10:01:29 +04:00
|
|
|
*/
|
1999-12-02 10:45:12 +03:00
|
|
|
[scriptable, uuid(aa610f20-a889-11d3-8c81-000064657374)]
|
|
|
|
interface nsILocalFile : nsIFile
|
|
|
|
{
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* initWith[Native]Path
|
2000-01-25 00:28:28 +03:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* This function will initialize the nsILocalFile object. Any
|
|
|
|
* internal state information will be reset.
|
2000-01-25 00:28:28 +03:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* 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!
|
2000-01-25 00:28:28 +03:00
|
|
|
*
|
|
|
|
* @param filePath
|
2002-05-03 10:01:29 +04:00
|
|
|
* A string which specifies a full file path to a
|
|
|
|
* location. Relative paths will be treated as an
|
2002-06-11 23:26:04 +04:00
|
|
|
* error (NS_ERROR_FILE_UNRECOGNIZED_PATH). For
|
|
|
|
* initWithNativePath, the filePath must be in the native
|
|
|
|
* filesystem charset.
|
2000-01-25 00:28:28 +03:00
|
|
|
*/
|
2002-05-08 03:07:19 +04:00
|
|
|
void initWithPath(in AString filePath);
|
2002-04-27 09:33:09 +04:00
|
|
|
[noscript] void initWithNativePath(in ACString filePath);
|
2000-07-13 03:31:31 +04:00
|
|
|
|
2002-04-09 18:12:24 +04:00
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* initWithFile
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* Initialize this object with another file
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* @param aFile
|
|
|
|
* the file this becomes equivalent to
|
2002-04-09 18:12:24 +04:00
|
|
|
*/
|
|
|
|
void initWithFile(in nsILocalFile aFile);
|
|
|
|
|
2000-07-13 03:31:31 +04:00
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Be aware that changing this attribute from true to false after
|
|
|
|
* the nsILocalFile 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 to false, the next usage would
|
|
|
|
* mostlikely fail.
|
2000-07-13 03:31:31 +04:00
|
|
|
*/
|
|
|
|
attribute PRBool followLinks;
|
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
[noscript] PRFileDescStar openNSPRFileDesc(in long flags, in long mode);
|
|
|
|
[noscript] FILE openANSIFileDesc(in string mode);
|
1999-12-02 10:45:12 +03:00
|
|
|
|
2000-01-25 00:28:28 +03:00
|
|
|
[noscript] PRLibraryStar load();
|
|
|
|
|
2002-10-06 04:26:20 +04:00
|
|
|
readonly attribute PRInt64 diskSpaceAvailable;
|
2000-05-05 09:47:32 +04:00
|
|
|
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* appendRelative[Native]Path
|
2000-05-05 09:47:32 +04:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* Append a relative path to the current path of the nsILocalFile object.
|
2000-05-05 09:47:32 +04:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* @param relativeFilePath
|
|
|
|
* relativeFilePath is a native relative path. For security reasons,
|
2002-06-11 23:26:04 +04:00
|
|
|
* this cannot contain .. or cannot start with a directory separator.
|
|
|
|
* For the |appendRelativeNativePath| method, the relativeFilePath
|
|
|
|
* must be in the native filesystem charset.
|
2000-05-05 09:47:32 +04:00
|
|
|
*/
|
2002-05-08 03:07:19 +04:00
|
|
|
void appendRelativePath(in AString relativeFilePath);
|
2002-04-27 09:33:09 +04:00
|
|
|
[noscript] void appendRelativeNativePath(in ACString relativeFilePath);
|
2000-07-17 18:57:14 +04:00
|
|
|
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* Accessor to a null terminated string which will specify
|
|
|
|
* the file in a persistent manner for disk storage.
|
2002-04-27 09:33:09 +04:00
|
|
|
*
|
2002-05-08 03:07:19 +04:00
|
|
|
* The character set of this attribute is undefined. DO NOT TRY TO
|
|
|
|
* INTERPRET IT AS HUMAN READABLE TEXT!
|
2000-07-17 18:57:14 +04:00
|
|
|
*/
|
2002-04-27 09:33:09 +04:00
|
|
|
attribute ACString persistentDescriptor;
|
2000-07-17 18:57:14 +04:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* 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...
|
2001-07-31 23:05:34 +04:00
|
|
|
*/
|
|
|
|
void reveal();
|
|
|
|
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* 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.
|
2001-07-31 23:05:34 +04:00
|
|
|
*/
|
|
|
|
void launch();
|
2002-04-09 18:12:24 +04:00
|
|
|
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* getRelativeDescriptor
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
2002-05-08 03:07:19 +04:00
|
|
|
* 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!
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
|
|
|
* @param fromFile
|
2002-05-03 10:01:29 +04:00
|
|
|
* the file from which the descriptor is relative
|
2002-04-09 18:12:24 +04:00
|
|
|
*/
|
2002-05-08 03:07:19 +04:00
|
|
|
ACString getRelativeDescriptor(in nsILocalFile fromFile);
|
2002-04-09 18:12:24 +04:00
|
|
|
|
|
|
|
/**
|
2002-05-03 10:01:29 +04:00
|
|
|
* setRelativeDescriptor
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
2002-05-03 10:01:29 +04:00
|
|
|
* Initializes the file to the location relative to fromFile using
|
|
|
|
* a string returned by getRelativeDescriptor.
|
2002-04-09 18:12:24 +04:00
|
|
|
*
|
|
|
|
* @param fromFile
|
2002-05-03 10:01:29 +04:00
|
|
|
* the file to which the descriptor is relative
|
2002-06-11 23:26:04 +04:00
|
|
|
* @param relative
|
|
|
|
* the relative descriptor obtained from getRelativeDescriptor
|
|
|
|
*/
|
2002-05-08 03:07:19 +04:00
|
|
|
void setRelativeDescriptor(in nsILocalFile fromFile, in ACString relativeDesc);
|
2000-01-25 00:28:28 +03:00
|
|
|
};
|
1999-12-02 10:45:12 +03:00
|
|
|
|
|
|
|
%{C++
|
2000-09-14 03:57:52 +04:00
|
|
|
#define NS_LOCAL_FILE_CONTRACTID "@mozilla.org/file/local;1"
|
1999-12-02 10:45:12 +03:00
|
|
|
#define NS_LOCAL_FILE_CLASSNAME "Local File Specification"
|
2000-01-25 00:28:28 +03:00
|
|
|
|
1999-12-02 10:45:12 +03:00
|
|
|
%}
|