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/. */
9 #include
<Carbon
/Carbon.h
>
10 #include
<CoreFoundation
/CoreFoundation.h
>
13 native OSType
(OSType
);
14 native FSSpec
(FSSpec
);
16 [ptr] native FSRefPtr
(FSRef
);
17 native CFURLRef
(CFURLRef
);
19 [scriptable
, builtinclass
, uuid(623eca5b
-c25d
-4e27
-be5a
-789a66c4b2f7
)]
20 interface nsILocalFileMac
: nsIFile
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
);
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
);
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
63 [noscript
] CFURLRef getCFURL
();
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
80 [noscript
] FSRef getFSRef
();
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.
95 [noscript
] FSSpec getFSSpec
();
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
;
110 * File type and creator attributes
113 [noscript
] attribute OSType fileType
;
114 [noscript
] attribute OSType fileCreator
;
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
);
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
);
143 * returns true if a directory is determined to be a package under Mac OS 9/X
151 * returns the display name of the application bundle (usually the human
152 * readable name of the application)
154 readonly attribute AString bundleDisplayName
;
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
);
209 NS_EXPORT nsresult NS_NewLocalFileWithFSRef
(const FSRef
* aFSRef
, nsILocalFileMac
** result
);
210 NS_EXPORT nsresult NS_NewLocalFileWithCFURL
(const CFURLRef aURL
, nsILocalFileMac
** result
);