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
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/
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
15 * The Original Code is mozilla.org code.
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.
23 * Conrad Carlen <ccarlen@netscape.com>
24 * Mark Mentovai <mark@moxienet.com>
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.
38 * ***** END LICENSE BLOCK ***** */
40 #include
"nsILocalFile.idl"
47 native OSType
(OSType
);
48 native FSSpec
(FSSpec
);
49 [ptr] native FSSpecPtr
(FSSpec
);
51 [ptr] native FSRefPtr
(FSRef
);
52 native CFURLRef
(CFURLRef
);
54 [scriptable
, uuid(748f3ffe
-27d9
-4402-9de9
-494badbeebf4
)]
55 interface nsILocalFileMac
: nsILocalFile
60 * Init this object with a CFURLRef
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.
65 * @param aCFURL the CoreFoundation URL
68 [noscript
] void initWithCFURL
(in CFURLRef aCFURL
);
73 * Init this object with an FSRef
75 * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
77 * @param aFSRef the native file spec
80 [noscript
] void initWithFSRef
([const] in FSRefPtr aFSRef
);
85 * Init this object with an FSSpec
86 * Legacy method - leaving in place for now
88 * @param aFileSpec the native file spec
91 [noscript
] void initWithFSSpec
([const] in FSSpecPtr aFileSpec
);
94 * initToAppWithCreatorCode
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.
100 * @param aAppCreator the signature of the app
103 [noscript
] void initToAppWithCreatorCode
(in OSType aAppCreator
);
108 * Returns the CFURLRef of the file object. The caller is
109 * responsible for calling CFRelease() on it.
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.
116 * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
121 [noscript
] CFURLRef getCFURL
();
126 * Returns the FSRef of the file object.
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.
133 * NOTE: Supported only for XP_MACOSX or TARGET_CARBON
138 [noscript
] FSRef getFSRef
();
143 * Returns the FSSpec of the file object.
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.
153 [noscript
] FSSpec getFSSpec
();
156 * fileSizeWithResFork
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()
163 readonly attribute PRInt64 fileSizeWithResFork
;
166 * Use with SetFileType() to specify the signature of current process
168 const unsigned long CURRENT_PROCESS_CREATOR
= 0x8000000;
173 * File type and creator attributes
176 [noscript
] attribute OSType fileType
;
177 [noscript
] attribute OSType fileCreator
;
180 * setFileTypeAndCreatorFromMIMEType
182 * Sets the file type and creator code from a MIME type.
183 * Internet Config is used to determine the mapping.
188 void setFileTypeAndCreatorFromMIMEType
(in string aMIMEType
);
191 * setFileTypeAndCreatorFromExtension
193 * Sets the file type and creator code from a file extension
194 * Internet Config is used to determine the mapping.
199 void setFileTypeAndCreatorFromExtension
(in string aExtension
);
204 * Launch the application that this file points to with a document.
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.
210 void launchWithDoc
(in nsILocalFile aDocToLoad
, in boolean aLaunchInBackground
);
215 * Open the document that this file points to with the given application.
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.
223 void openDocWithApp
(in nsILocalFile aAppToOpenWith
, in boolean aLaunchInBackground
);
228 * returns true if a directory is determined to be a package under Mac OS 9/X
236 * returns the display name of the application bundle (usually the human
237 * readable name of the application)
239 readonly attribute AString bundleDisplayName
;
244 * returns the identifier of the bundle
246 readonly attribute AUTF8String bundleIdentifier
;
254 NS_EXPORT
const char* NS_TruncNodeName
(const char *aNode
, char *outBuf
);
257 NS_EXPORT nsresult NS_NewLocalFileWithFSSpec
(const FSSpec
* inSpec
, PRBool followSymlinks
, nsILocalFileMac
* *result
);
259 // NS_NewLocalFileWithFSRef is available since Mozilla 1.8.1.
260 NS_EXPORT nsresult NS_NewLocalFileWithFSRef
(const FSRef
* aFSRef
, PRBool aFollowSymlinks
, nsILocalFileMac
** result
);