gecko-dev/netwerk/protocol/file/public/nsIFileChannel.idl

132 строки
3.5 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsIChannel.idl"
interface nsISimpleEnumerator;
native nsFileSpec(nsFileSpec);
%{C++
#include "nsFileSpec.h"
%}
[scriptable, uuid(73025830-0ce2-11d3-9331-00104ba0fd40)]
interface nsIFileChannel : nsIChannel
{
/**
* Returns the last modification date of the URL.
*/
readonly attribute PRTime ModDate;
/**
* Returns the size of the file referred to by the URL.
* @return NS_ERROR_FAILURE if the URL refers to a directory.
*/
readonly attribute unsigned long FileSize;
/**
* Returns the parent directory of a URL.
*/
readonly attribute nsIFileChannel Parent;
/**
* Returns an enumeration of the elements in a directory. Each
* element in the enumeration is an nsIFileChannel.
* @return NS_ERROR_FAILURE if the current nsIFileChannel does
* not specify a directory.
*/
readonly attribute nsISimpleEnumerator Children;
/**
* Returns a native path string suitable to be passes to native platform
* routines.
*/
readonly attribute string NativePath;
/**
* Returns true if the file exists.
*/
boolean Exists();
/**
* Creates an empty file if the file does not exist.
*/
void Create();
/**
* Returns true if the file exists.
*/
void Delete();
/**
* Move or rename a file.
*/
void MoveFrom(in nsIURI src);
/**
* Copies the contents of a file to a new destination. Creates the
* destination file if it doesn't already exist, otherwise overwrites
* it.
*/
void CopyFrom(in nsIURI src);
/**
* Returns true if the file URL specifies a directory. Note that this
* may be the case even if the file URL does not terminate with a slash.
*/
boolean IsDirectory();
/**
* Returns true if the file URL specifies a file and not a directory.
*/
boolean IsFile();
/**
* Returns true if the specified file is a symbolic link (on unix),
* alias (on Mac) or shortcut (on Windows).
*/
boolean IsLink();
/**
* Returns a file URL to the destination of a link (alias or shortcut).
*/
nsIFileChannel ResolveLink();
/**
* Returns a new unique unique file channel for the directory of the current URL.
*/
nsIFileChannel MakeUnique(in string baseName);
/**
* Executes a program specified by the file channel.
* @param args - The program arguments to run with. If not specified,
* the Query portion of the URI is used as the argument string.
*/
void Execute(in string args);
/**
* XXX Until we eliminate nsFileSpec...
*/
[noscript] void GetFileSpec(out nsFileSpec spec);
};