michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsILocalFile.idl" michael@0: michael@0: %{C++ michael@0: #include michael@0: #include michael@0: %} michael@0: michael@0: native OSType(OSType); michael@0: native FSSpec(FSSpec); michael@0: native FSRef(FSRef); michael@0: [ptr] native FSRefPtr(FSRef); michael@0: native CFURLRef(CFURLRef); michael@0: michael@0: [scriptable, builtinclass, uuid(E5DE2CC9-BF06-4329-8F91-5D2D45284500)] michael@0: interface nsILocalFileMac : nsILocalFile michael@0: { michael@0: /** michael@0: * initWithCFURL michael@0: * michael@0: * Init this object with a CFURLRef michael@0: * michael@0: * NOTE: Supported only for XP_MACOSX michael@0: * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand. michael@0: * michael@0: * @param aCFURL the CoreFoundation URL michael@0: * michael@0: */ michael@0: [noscript] void initWithCFURL(in CFURLRef aCFURL); michael@0: michael@0: /** michael@0: * initWithFSRef michael@0: * michael@0: * Init this object with an FSRef michael@0: * michael@0: * NOTE: Supported only for XP_MACOSX michael@0: * michael@0: * @param aFSRef the native FSRef michael@0: * michael@0: */ michael@0: [noscript] void initWithFSRef([const] in FSRefPtr aFSRef); michael@0: michael@0: /** michael@0: * getCFURL michael@0: * michael@0: * Returns the CFURLRef of the file object. The caller is michael@0: * responsible for calling CFRelease() on it. michael@0: * michael@0: * NOTE: Observes the state of the followLinks attribute. michael@0: * If the file object is an alias and followLinks is TRUE, returns michael@0: * the target of the alias. If followLinks is FALSE, returns michael@0: * the unresolved alias file. michael@0: * michael@0: * NOTE: Supported only for XP_MACOSX michael@0: * michael@0: * @return michael@0: * michael@0: */ michael@0: [noscript] CFURLRef getCFURL(); michael@0: michael@0: /** michael@0: * getFSRef michael@0: * michael@0: * Returns the FSRef of the file object. michael@0: * michael@0: * NOTE: Observes the state of the followLinks attribute. michael@0: * If the file object is an alias and followLinks is TRUE, returns michael@0: * the target of the alias. If followLinks is FALSE, returns michael@0: * the unresolved alias file. michael@0: * michael@0: * NOTE: Supported only for XP_MACOSX michael@0: * michael@0: * @return michael@0: * michael@0: */ michael@0: [noscript] FSRef getFSRef(); michael@0: michael@0: /** michael@0: * getFSSpec michael@0: * michael@0: * Returns the FSSpec of the file object. michael@0: * michael@0: * NOTE: Observes the state of the followLinks attribute. michael@0: * If the file object is an alias and followLinks is TRUE, returns michael@0: * the target of the alias. If followLinks is FALSE, returns michael@0: * the unresolved alias file. michael@0: * michael@0: * @return michael@0: * michael@0: */ michael@0: [noscript] FSSpec getFSSpec(); michael@0: michael@0: /** michael@0: * fileSizeWithResFork michael@0: * michael@0: * Returns the combined size of both the data fork and the resource michael@0: * fork (if present) rather than just the size of the data fork michael@0: * as returned by GetFileSize() michael@0: * michael@0: */ michael@0: readonly attribute int64_t fileSizeWithResFork; michael@0: michael@0: /** michael@0: * fileType, creator michael@0: * michael@0: * File type and creator attributes michael@0: * michael@0: */ michael@0: [noscript] attribute OSType fileType; michael@0: [noscript] attribute OSType fileCreator; michael@0: michael@0: /** michael@0: * launchWithDoc michael@0: * michael@0: * Launch the application that this file points to with a document. michael@0: * michael@0: * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch michael@0: * @param aLaunchInBackground TRUE if the application should not come to the front. michael@0: * michael@0: */ michael@0: void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground); michael@0: michael@0: /** michael@0: * openDocWithApp michael@0: * michael@0: * Open the document that this file points to with the given application. michael@0: * michael@0: * @param aAppToOpenWith The application with which to open the document. michael@0: * If NULL, the creator code of the document is used michael@0: * to determine the application. michael@0: * @param aLaunchInBackground TRUE if the application should not come to the front. michael@0: * michael@0: */ michael@0: void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground); michael@0: michael@0: /** michael@0: * isPackage michael@0: * michael@0: * returns true if a directory is determined to be a package under Mac OS 9/X michael@0: * michael@0: */ michael@0: boolean isPackage(); michael@0: michael@0: /** michael@0: * bundleDisplayName michael@0: * michael@0: * returns the display name of the application bundle (usually the human michael@0: * readable name of the application) michael@0: */ michael@0: readonly attribute AString bundleDisplayName; michael@0: michael@0: /** michael@0: * bundleIdentifier michael@0: * michael@0: * returns the identifier of the bundle michael@0: */ michael@0: readonly attribute AUTF8String bundleIdentifier; michael@0: michael@0: /** michael@0: * Last modified time of a bundle's contents (as opposed to its package michael@0: * directory). Our convention is to make the bundle's Info.plist file michael@0: * stand in for the rest of its contents -- since this file contains the michael@0: * bundle's version information and other identifiers. For non-bundles michael@0: * this is the same as lastModifiedTime. michael@0: */ michael@0: readonly attribute int64_t bundleContentsLastModifiedTime; michael@0: }; michael@0: michael@0: %{C++ michael@0: extern "C" michael@0: { michael@0: NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowSymlinks, nsILocalFileMac** result); michael@0: NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowSymlinks, nsILocalFileMac** result); michael@0: } michael@0: %}