Bug 1910362 - Create new Nimbus helper r=aaronmt,ohorvath
[gecko.git] / xpcom / io / nsILocalFileMac.idl
blob86186ca89113ded99fa1d813c0be4ac8f691fa0d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsIFile.idl"
8 %{C++
9 #include <Carbon/Carbon.h>
10 #include <CoreFoundation/CoreFoundation.h>
13 native OSType(OSType);
14 native FSSpec(FSSpec);
15 native FSRef(FSRef);
16 [ptr] native FSRefPtr(FSRef);
17 native CFURLRef(CFURLRef);
19 [scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)]
20 interface nsILocalFileMac : nsIFile
22 /**
23 * initWithCFURL
25 * Init this object with a CFURLRef
27 * NOTE: Supported only for XP_MACOSX
28 * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
30 * @param aCFURL the CoreFoundation URL
33 [noscript] void initWithCFURL(in CFURLRef aCFURL);
35 /**
36 * initWithFSRef
38 * Init this object with an FSRef
40 * NOTE: Supported only for XP_MACOSX
42 * @param aFSRef the native FSRef
45 [noscript] void initWithFSRef([const] in FSRefPtr aFSRef);
47 /**
48 * getCFURL
50 * Returns the CFURLRef of the file object. The caller is
51 * responsible for calling CFRelease() on it.
53 * NOTE: Observes the state of the followLinks attribute.
54 * If the file object is an alias and followLinks is TRUE, returns
55 * the target of the alias. If followLinks is FALSE, returns
56 * the unresolved alias file.
58 * NOTE: Supported only for XP_MACOSX
60 * @return
63 [noscript] CFURLRef getCFURL();
65 /**
66 * getFSRef
68 * Returns the FSRef of the file object.
70 * NOTE: Observes the state of the followLinks attribute.
71 * If the file object is an alias and followLinks is TRUE, returns
72 * the target of the alias. If followLinks is FALSE, returns
73 * the unresolved alias file.
75 * NOTE: Supported only for XP_MACOSX
77 * @return
80 [noscript] FSRef getFSRef();
82 /**
83 * getFSSpec
85 * Returns the FSSpec of the file object.
87 * NOTE: Observes the state of the followLinks attribute.
88 * If the file object is an alias and followLinks is TRUE, returns
89 * the target of the alias. If followLinks is FALSE, returns
90 * the unresolved alias file.
92 * @return
95 [noscript] FSSpec getFSSpec();
97 /**
98 * fileSizeWithResFork
100 * Returns the combined size of both the data fork and the resource
101 * fork (if present) rather than just the size of the data fork
102 * as returned by GetFileSize()
105 readonly attribute int64_t fileSizeWithResFork;
108 * fileType, creator
110 * File type and creator attributes
113 [noscript] attribute OSType fileType;
114 [noscript] attribute OSType fileCreator;
117 * launchWithDoc
119 * Launch the application that this file points to with a document.
121 * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch
122 * @param aLaunchInBackground TRUE if the application should not come to the front.
125 void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground);
128 * openDocWithApp
130 * Open the document that this file points to with the given application.
132 * @param aAppToOpenWith The application with which to open the document.
133 * If NULL, the creator code of the document is used
134 * to determine the application.
135 * @param aLaunchInBackground TRUE if the application should not come to the front.
138 void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground);
141 * isPackage
143 * returns true if a directory is determined to be a package under Mac OS 9/X
146 boolean isPackage();
149 * bundleDisplayName
151 * returns the display name of the application bundle (usually the human
152 * readable name of the application)
154 readonly attribute AString bundleDisplayName;
157 * bundleIdentifier
159 * returns the identifier of the bundle
161 readonly attribute AUTF8String bundleIdentifier;
164 * Last modified time of a bundle's contents (as opposed to its package
165 * directory). Our convention is to make the bundle's Info.plist file
166 * stand in for the rest of its contents -- since this file contains the
167 * bundle's version information and other identifiers. For non-bundles
168 * this is the same as lastModifiedTime.
170 readonly attribute int64_t bundleContentsLastModifiedTime;
173 * Return whether or not the file has an extended attribute.
175 * @param aAttrName The attribute name to check for.
177 * @return Whether or not the extended attribute is present.
179 boolean hasXAttr(in ACString aAttrName);
182 * Get the value of the extended attribute.
184 * @param aAttrName The attribute name to read.
186 * @return The extended attribute value.
188 Array<uint8_t> getXAttr(in ACString aAttrName);
191 * Set an extended attribute.
193 * @param aAttrName The attribute name to set a value for.
194 * @param aAttrValue The value to set for the attribute.
196 void setXAttr(in ACString aAttrName, in Array<uint8_t> aAttrValue);
199 * Delete an extended attribute.
201 * @param aAttrName The extended attribute to delete.
203 void delXAttr(in ACString aAttrName);
206 %{C++
207 extern "C"
209 NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, nsILocalFileMac** result);
210 NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, nsILocalFileMac** result);