gecko-dev/xpfe/appshell/public/nsIFileLocator.idl

72 строки
2.1 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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.
*
* 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):
*/
%{ C++
#include "nscore.h"
#include "nsIServiceManager.h"
%}
#include "nsISupports.idl"
interface nsIFileSpec;
[scriptable, uuid(7e44eb01-e600-11d2-915f-f08a208628fc)]
interface nsIFileLocator : nsISupports
{
nsIFileSpec GetFileLocation(
in unsigned long selector
// NOTE: actually an amalgam of
// nsSpecialFileSpec:Type and nsSpecialSystemDirectory
// see nsFileLocations.h and nsSpecialSystemDirectory.h. Declared as
// PRUint32 for COM use.
);
void ForgetProfileDir();
};
%{ C++
// {CFC599F0-04CA-11d3-8068-00600811A9C3}
// {78043e01-e603-11d2-915f-f08a208628fc}
#define NS_FILELOCATOR_CID \
{ 0x78043e01, 0xe603, 0x11d2, \
{0x91, 0x5f, 0xf0, 0x8a, 0x20, 0x86, 0x28, 0xfc} }
#define NS_FILELOCATOR_CONTRACTID \
"@mozilla.org/filelocator;1"
// Factory method used in NSGetFactory for appshell.
extern "C" NS_APPSHELL nsresult
NS_NewFileLocatorFactory(nsIFactory** aFactory);
// Mostly, all you want to do is this:
inline nsIFileSpec* NS_LocateFileOrDirectory(PRUint32 selector)
{
nsresult rv;
nsIFileSpec* spec = nsnull;
NS_WITH_SERVICE(nsIFileLocator, locator, NS_FILELOCATOR_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && locator)
locator->GetFileLocation(selector, &spec);
return spec;
}
%}