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 <[email protected]>
|
---|
24 | *
|
---|
25 | * Alternatively, the contents of this file may be used under the terms of
|
---|
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
29 | * of those above. If you wish to allow use of your version of this file only
|
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
31 | * use your version of this file under the terms of the MPL, indicate your
|
---|
32 | * decision by deleting the provisions above and replace them with the notice
|
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
34 | * the provisions above, a recipient may use your version of this file under
|
---|
35 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
36 | *
|
---|
37 | * ***** END LICENSE BLOCK ***** */
|
---|
38 |
|
---|
39 | #include "nsILocalFile.idl"
|
---|
40 |
|
---|
41 | %{C++
|
---|
42 | #include <Files.h>
|
---|
43 | #include <CFURL.h>
|
---|
44 | %}
|
---|
45 |
|
---|
46 | native OSType(OSType);
|
---|
47 | native FSSpec(FSSpec);
|
---|
48 | [ptr] native FSSpecPtr(FSSpec);
|
---|
49 | native FSRef(FSRef);
|
---|
50 | [ptr] native FSRefPtr(FSRef);
|
---|
51 | native CFURLRef(CFURLRef);
|
---|
52 |
|
---|
53 | [uuid(614c3010-1dd2-11b2-be04-bcd57a64ffc9)]
|
---|
54 | interface nsILocalFileMac : nsILocalFile
|
---|
55 | {
|
---|
56 | /**
|
---|
57 | * initWithCFURL
|
---|
58 | *
|
---|
59 | * Init this object with a CFURLRef
|
---|
60 | *
|
---|
61 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
62 | * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
|
---|
63 | *
|
---|
64 | * @param aCFURL the CoreFoundation URL
|
---|
65 | *
|
---|
66 | */
|
---|
67 | void initWithCFURL(in CFURLRef aCFURL);
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * initWithFSRef
|
---|
71 | *
|
---|
72 | * Init this object with an FSRef
|
---|
73 | *
|
---|
74 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
75 | *
|
---|
76 | * @param aFSRef the native file spec
|
---|
77 | *
|
---|
78 | */
|
---|
79 | void initWithFSRef([const] in FSRefPtr aFSRef);
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * initWithFSSpec
|
---|
83 | *
|
---|
84 | * Init this object with an FSSpec
|
---|
85 | * Legacy method - leaving in place for now
|
---|
86 | *
|
---|
87 | * @param aFileSpec the native file spec
|
---|
88 | *
|
---|
89 | */
|
---|
90 | void initWithFSSpec([const] in FSSpecPtr aFileSpec);
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * initToAppWithCreatorCode
|
---|
94 | *
|
---|
95 | * Init this object to point to an application having the given
|
---|
96 | * creator code. If this app is missing, this will fail. It will first
|
---|
97 | * look for running application with the given creator.
|
---|
98 | *
|
---|
99 | * @param aAppCreator the signature of the app
|
---|
100 | *
|
---|
101 | */
|
---|
102 | void initToAppWithCreatorCode(in OSType aAppCreator);
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * getCFURL
|
---|
106 | *
|
---|
107 | * Returns the CFURLRef of the file object. The caller is
|
---|
108 | * responsible for calling CFRelease() on it.
|
---|
109 | *
|
---|
110 | * NOTE: Observes the state of the followLinks attribute.
|
---|
111 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
112 | * the target of the alias. If followLinks is FALSE, returns
|
---|
113 | * the unresolved alias file.
|
---|
114 | *
|
---|
115 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
116 | *
|
---|
117 | * @return
|
---|
118 | *
|
---|
119 | */
|
---|
120 | CFURLRef getCFURL();
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * getFSRef
|
---|
124 | *
|
---|
125 | * Returns the FSRef of the file object.
|
---|
126 | *
|
---|
127 | * NOTE: Observes the state of the followLinks attribute.
|
---|
128 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
129 | * the target of the alias. If followLinks is FALSE, returns
|
---|
130 | * the unresolved alias file.
|
---|
131 | *
|
---|
132 | * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
|
---|
133 | *
|
---|
134 | * @return
|
---|
135 | *
|
---|
136 | */
|
---|
137 | FSRef getFSRef();
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * getFSSpec
|
---|
141 | *
|
---|
142 | * Returns the FSSpec of the file object.
|
---|
143 | *
|
---|
144 | * NOTE: Observes the state of the followLinks attribute.
|
---|
145 | * If the file object is an alias and followLinks is TRUE, returns
|
---|
146 | * the target of the alias. If followLinks is FALSE, returns
|
---|
147 | * the unresolved alias file.
|
---|
148 | *
|
---|
149 | * @return
|
---|
150 | *
|
---|
151 | */
|
---|
152 | FSSpec getFSSpec();
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * fileSizeWithResFork
|
---|
156 | *
|
---|
157 | * Returns the combined size of both the data fork and the resource
|
---|
158 | * fork (if present) rather than just the size of the data fork
|
---|
159 | * as returned by GetFileSize()
|
---|
160 | *
|
---|
161 | */
|
---|
162 | readonly attribute PRInt64 fileSizeWithResFork;
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Use with SetFileType() to specify the signature of current process
|
---|
166 | */
|
---|
167 | const unsigned long CURRENT_PROCESS_CREATOR = 0x8000000;
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * fileType, creator
|
---|
171 | *
|
---|
172 | * File type and creator attributes
|
---|
173 | *
|
---|
174 | */
|
---|
175 | attribute OSType fileType;
|
---|
176 | attribute OSType fileCreator;
|
---|
177 |
|
---|
178 | /**
|
---|
179 | * setFileTypeAndCreatorFromMIMEType
|
---|
180 | *
|
---|
181 | * Sets the file type and creator code from a MIME type.
|
---|
182 | * Internet Config is used to determine the mapping.
|
---|
183 | *
|
---|
184 | * @param aMIMEType
|
---|
185 | *
|
---|
186 | */
|
---|
187 | void setFileTypeAndCreatorFromMIMEType(in string aMIMEType);
|
---|
188 |
|
---|
189 | /**
|
---|
190 | * setFileTypeAndCreatorFromExtension
|
---|
191 | *
|
---|
192 | * Sets the file type and creator code from a file extension
|
---|
193 | * Internet Config is used to determine the mapping.
|
---|
194 | *
|
---|
195 | * @param aExtension
|
---|
196 | *
|
---|
197 | */
|
---|
198 | void setFileTypeAndCreatorFromExtension(in string aExtension);
|
---|
199 |
|
---|
200 | /**
|
---|
201 | * launchWithDoc
|
---|
202 | *
|
---|
203 | * Launch the application that this file points to with a document.
|
---|
204 | *
|
---|
205 | * @param aDocToLoad Must not be NULL. If no document, use nsILocalFile::launch
|
---|
206 | * @param aLaunchInBackground TRUE if the application should not come to the front.
|
---|
207 | *
|
---|
208 | */
|
---|
209 | void launchWithDoc(in nsILocalFile aDocToLoad, in boolean aLaunchInBackground);
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * openDocWithApp
|
---|
213 | *
|
---|
214 | * Open the document that this file points to with the given application.
|
---|
215 | *
|
---|
216 | * @param aAppToOpenWith The application with which to open the document.
|
---|
217 | * If NULL, the creator code of the document is used
|
---|
218 | * to determine the application.
|
---|
219 | * @param aLaunchInBackground TRUE if the application should not come to the front.
|
---|
220 | *
|
---|
221 | */
|
---|
222 | void openDocWithApp(in nsILocalFile aAppToOpenWith, in boolean aLaunchInBackground);
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * isPackage
|
---|
226 | *
|
---|
227 | * returns true if a directory is determined to be a package under Mac OS 9/X
|
---|
228 | *
|
---|
229 | */
|
---|
230 | boolean isPackage();
|
---|
231 | };
|
---|
232 |
|
---|
233 | %{C++
|
---|
234 | extern "C"
|
---|
235 | {
|
---|
236 |
|
---|
237 | #ifndef XP_MACOSX
|
---|
238 | NS_EXPORT const char* NS_TruncNodeName(const char *aNode, char *outBuf);
|
---|
239 | #endif
|
---|
240 |
|
---|
241 | NS_EXPORT nsresult NS_NewLocalFileWithFSSpec(const FSSpec* inSpec, PRBool followSymlinks, nsILocalFileMac* *result);
|
---|
242 | }
|
---|
243 | %}
|
---|