1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 2001
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | * Conrad Carlen <ccarlen@netscape.com>
|
---|
24 | * Mark Mentovai <mark@moxienet.com>
|
---|
25 | *
|
---|
26 | * Alternatively, the contents of this file may be used under the terms of
|
---|
27 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
28 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
29 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
30 | * of those above. If you wish to allow use of your version of this file only
|
---|
31 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
32 | * use your version of this file under the terms of the MPL, indicate your
|
---|
33 | * decision by deleting the provisions above and replace them with the notice
|
---|
34 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
35 | * the provisions above, a recipient may use your version of this file under
|
---|
36 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
37 | *
|
---|
38 | * ***** END LICENSE BLOCK ***** */
|
---|
39 |
|
---|
40 | #include "nsILocalFile.idl"
|
---|
41 |
|
---|
42 | %{C++
|
---|
43 | #include <Files.h>
|
---|
44 | #include <CFURL.h>
|
---|
45 | %}
|
---|
46 |
|
---|
47 | native OSType(OSType);
|
---|
48 | native FSSpec(FSSpec);
|
---|
49 | [ptr] native FSSpecPtr(FSSpec);
|
---|
50 | native FSRef(FSRef);
|
---|
51 | [ptr] native FSRefPtr(FSRef);
|
---|
52 | native CFURLRef(CFURLRef);
|
---|
53 |
|
---|
54 | [scriptable, uuid(748f3ffe-27d9-4402-9de9-494badbeebf4)]
|
---|
55 | interface nsILocalFileMac : nsILocalFile
|
---|
56 | {
|
---|
57 | /**
|
---|
58 | * initWithCFURL
|
---|
59 | *
|
---|
60 | * Init this object with a CFURLRef
|
---|
61 | *
|
---|
62 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
63 | * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
|
---|
64 | *
|
---|
65 | * @param aCFURL the CoreFoundation URL
|
---|
66 | *
|
---|
67 | */
|
---|
68 | [noscript] void initWithCFURL(in CFURLRef aCFURL);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * initWithFSRef
|
---|
72 | *
|
---|
73 | * Init this object with an FSRef
|
---|
74 | *
|
---|
75 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
76 | *
|
---|
77 | * @param aFSRef the native file spec
|
---|
78 | *
|
---|
79 | */
|
---|
80 | [noscript] void initWithFSRef([const] in FSRefPtr aFSRef);
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * initWithFSSpec
|
---|
84 | *
|
---|
85 | * Init this object with an FSSpec
|
---|
86 | * Legacy method - leaving in place for now
|
---|
87 | *
|
---|
88 | * @param aFileSpec the native file spec
|
---|
89 | *
|
---|
90 | */
|
---|
91 | [noscript] void initWithFSSpec([const] in FSSpecPtr aFileSpec);
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * initToAppWithCreatorCode
|
---|
95 | *
|
---|
96 | * Init this object to point to an application having the given
|
---|
97 | * creator code. If this app is missing, this will fail. It will first
|
---|
98 | * look for running application with the given creator.
|
---|
99 | *
|
---|
100 | * @param aAppCreator the signature of the app
|
---|
101 | *
|
---|
102 | */
|
---|
103 | [noscript] void initToAppWithCreatorCode(in OSType aAppCreator);
|
---|
104 |
|
---|
105 | /**
|
---|
106 | * getCFURL
|
---|
107 | *
|
---|
108 | * Returns the CFURLRef of the file object. The caller is
|
---|
109 | * responsible for calling CFRelease() on it.
|
---|
110 | *
|
---|
111 | * NOTE: Observes the state of the followLinks attribute.
|
---|
112 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
113 | * the target of the alias. If followLinks is FALSE, returns
|
---|
114 | * the unresolved alias file.
|
---|
115 | *
|
---|
116 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
117 | *
|
---|
118 | * @return
|
---|
119 | *
|
---|
120 | */
|
---|
121 | [noscript] CFURLRef getCFURL();
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * getFSRef
|
---|
125 | *
|
---|
126 | * Returns the FSRef of the file object.
|
---|
127 | *
|
---|
128 | * NOTE: Observes the state of the followLinks attribute.
|
---|
129 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
130 | * the target of the alias. If followLinks is FALSE, returns
|
---|
131 | * the unresolved alias file.
|
---|
132 | *
|
---|
133 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
134 | *
|
---|
135 | * @return
|
---|
136 | *
|
---|
137 | */
|
---|
138 | [noscript] FSRef getFSRef();
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * getFSSpec
|
---|
142 | *
|
---|
143 | * Returns the FSSpec of the file object.
|
---|
144 | *
|
---|
145 | * NOTE: Observes the state of the followLinks attribute.
|
---|
146 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
147 | * the target of the alias. If followLinks is FALSE, returns
|
---|
148 | * the unresolved alias file.
|
---|
149 | *
|
---|
150 | * @return
|
---|
151 | *
|
---|
152 | */
|
---|
153 | [noscript] FSSpec getFSSpec();
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * fileSizeWithResFork
|
---|
157 | *
|
---|
158 | * Returns the combined size of both the data fork and the resource
|
---|
159 | * fork (if present) rather than just the size of the data fork
|
---|
160 | * as returned by GetFileSize()
|
---|
161 | *
|
---|
162 | */
|
---|
163 | readonly attribute PRInt64 fileSizeWithResFork;
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * Use with SetFileType() to specify the signature of current process
|
---|
167 | */
|
---|
168 | const unsigned long CURRENT_PROCESS_CREATOR = 0x8000000;
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * fileType, creator
|
---|
172 | *
|
---|
173 | * File type and creator attributes
|
---|
174 | *
|
---|
175 | */
|
---|
176 | [noscript] attribute OSType fileType;
|
---|
177 | [noscript] attribute OSType fileCreator;
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * setFileTypeAndCreatorFromMIMEType
|
---|
181 | *
|
---|
182 | * Sets the file type and creator code from a MIME type.
|
---|
183 | * Internet Config is used to determine the mapping.
|
---|
184 | *
|
---|
185 | * @param aMIMEType
|
---|
186 | *
|
---|
187 | */
|
---|
188 | void setFileTypeAndCreatorFromMIMEType(in string aMIMEType);
|
---|
189 |
|
---|
190 | /**
|
---|
191 | * setFileTypeAndCreatorFromExtension
|
---|
192 | *
|
---|
193 | * Sets the file type and creator code from a file extension
|
---|
194 | * Internet Config is used to determine the mapping.
|
---|
195 | *
|
---|
196 | * @param aExtension
|
---|
197 | *
|
---|
198 | */
|
---|
199 | void setFileTypeAndCreatorFromExtension(in string aExtension);
|
---|
200 |
|
---|
201 | /**
|
---|
202 | * launchWithDoc
|
---|
203 | *
|
---|
204 | * Launch the application that this file points to with a document.
|
---|
205 | *
|
---|
206 | * @param aDocToLoad Must not be NULL. If no document, use nsILocalFile::launch
|
---|
207 | * @param aLaunchInBackground TRUE if the application should not come to the front.
|
---|
208 | *
|
---|
209 | */
|
---|
210 | void launchWithDoc(in nsILocalFile aDocToLoad, in boolean aLaunchInBackground);
|
---|
211 |
|
---|
212 | /**
|
---|
213 | * openDocWithApp
|
---|
214 | *
|
---|
215 | * Open the document that this file points to with the given application.
|
---|
216 | *
|
---|
217 | * @param aAppToOpenWith The application with which to open the document.
|
---|
218 | * If NULL, the creator code of the document is used
|
---|
219 | * to determine the application.
|
---|
220 | * @param aLaunchInBackground TRUE if the application should not come to the front.
|
---|
221 | *
|
---|
222 | */
|
---|
223 | void openDocWithApp(in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground);
|
---|
224 |
|
---|
225 | /**
|
---|
226 | * isPackage
|
---|
227 | *
|
---|
228 | * returns true if a directory is determined to be a package under Mac OS 9/X
|
---|
229 | *
|
---|
230 | */
|
---|
231 | boolean isPackage();
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * bundleDisplayName
|
---|
235 | *
|
---|
236 | * returns the display name of the application bundle (usually the human
|
---|
237 | * readable name of the application)
|
---|
238 | */
|
---|
239 | readonly attribute AString bundleDisplayName;
|
---|
240 |
|
---|
241 | /**
|
---|
242 | * bundleIdentifier
|
---|
243 | *
|
---|
244 | * returns the identifier of the bundle
|
---|
245 | */
|
---|
246 | readonly attribute AUTF8String bundleIdentifier;
|
---|
247 | };
|
---|
248 |
|
---|
249 | %{C++
|
---|
250 | extern "C"
|
---|
251 | {
|
---|
252 |
|
---|
253 | #ifndef XP_MACOSX
|
---|
254 | NS_EXPORT const char* NS_TruncNodeName(const char *aNode, char *outBuf);
|
---|
255 | #endif
|
---|
256 |
|
---|
257 | NS_EXPORT nsresult NS_NewLocalFileWithFSSpec(const FSSpec* inSpec, PRBool followSymlinks, nsILocalFileMac* *result);
|
---|
258 |
|
---|
259 | // NS_NewLocalFileWithFSRef is available since Mozilla 1.8.1.
|
---|
260 | NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, PRBool aFollowSymlinks, nsILocalFileMac** result);
|
---|
261 | }
|
---|
262 | %}
|
---|