summaryrefslogtreecommitdiff
path: root/xpcom/io/nsILocalFileMac.idl
blob: d8655449bbb2826e29fba8f410ff2604091dbfaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsILocalFile.idl"

%{C++
#include <Carbon/Carbon.h>
#include <CoreFoundation/CoreFoundation.h>
%}

      native OSType(OSType);
      native FSSpec(FSSpec);
      native FSRef(FSRef);
[ptr] native FSRefPtr(FSRef);
      native CFURLRef(CFURLRef);

[scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)]
interface nsILocalFileMac : nsILocalFile
{
   /**
    * initWithCFURL
    *
    * Init this object with a CFURLRef
    *
    * NOTE: Supported only for XP_MACOSX
    * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
    *
    * @param   aCFURL         the CoreFoundation URL
    *
    */
  [noscript] void initWithCFURL(in CFURLRef aCFURL);

   /**
    * initWithFSRef
    *
    * Init this object with an FSRef
    *
    * NOTE: Supported only for XP_MACOSX
    *
    * @param   aFSRef         the native FSRef
    *
    */
  [noscript] void initWithFSRef([const] in FSRefPtr aFSRef);

    /**
    * getCFURL
    *
    * Returns the CFURLRef of the file object. The caller is
    * responsible for calling CFRelease() on it.
    *
    * NOTE: Observes the state of the followLinks attribute.
    * If the file object is an alias and followLinks is TRUE, returns
    * the target of the alias. If followLinks is FALSE, returns
    * the unresolved alias file.
    *
    * NOTE: Supported only for XP_MACOSX
    *
    * @return
    *  
    */ 
  [noscript] CFURLRef getCFURL();
 
    /**
    * getFSRef
    *
    * Returns the FSRef of the file object.
    *
    * NOTE: Observes the state of the followLinks attribute.
    * If the file object is an alias and followLinks is TRUE, returns
    * the target of the alias. If followLinks is FALSE, returns
    * the unresolved alias file.
    *
    * NOTE: Supported only for XP_MACOSX
    *
    * @return
    *  
    */ 
  [noscript] FSRef getFSRef();
   
   /**
    * getFSSpec
    *
    * Returns the FSSpec of the file object.
    *
    * NOTE: Observes the state of the followLinks attribute.
    * If the file object is an alias and followLinks is TRUE, returns
    * the target of the alias. If followLinks is FALSE, returns
    * the unresolved alias file.
    *
    * @return
    *  
    */ 
  [noscript] FSSpec getFSSpec();

   /**
    * fileSizeWithResFork
    * 
    * Returns the combined size of both the data fork and the resource
    * fork (if present) rather than just the size of the data fork
    * as returned by GetFileSize()
    *
    */
   readonly attribute int64_t fileSizeWithResFork;

   /**
    * fileType, creator
    *
    * File type and creator attributes
    *
    */
   [noscript] attribute OSType fileType;
   [noscript] attribute OSType fileCreator;

   /**
    * launchWithDoc
    *
    * Launch the application that this file points to with a document.
    *
    * @param   aDocToLoad          Must not be NULL. If no document, use nsIFile::launch
    * @param   aLaunchInBackground TRUE if the application should not come to the front.
    *
    */
   void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground);

   /**
    * openDocWithApp
    *
    * Open the document that this file points to with the given application.
    *
    * @param   aAppToOpenWith      The application with  which to open the document.
    *                              If NULL, the creator code of the document is used
    *                              to determine the application.
    * @param   aLaunchInBackground TRUE if the application should not come to the front.
    *
    */
   void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground);

   /**
    * isPackage
    *
    * returns true if a directory is determined to be a package under Mac OS 9/X
    *
    */
   boolean isPackage();

   /**
    * bundleDisplayName
    *
    * returns the display name of the application bundle (usually the human 
    * readable name of the application)
    */
   readonly attribute AString bundleDisplayName;

   /**
    * bundleIdentifier
    *
    * returns the identifier of the bundle
    */
   readonly attribute AUTF8String bundleIdentifier;

    /**
     * Last modified time of a bundle's contents (as opposed to its package
     * directory).  Our convention is to make the bundle's Info.plist file
     * stand in for the rest of its contents -- since this file contains the
     * bundle's version information and other identifiers.  For non-bundles
     * this is the same as lastModifiedTime.
     */
    readonly attribute int64_t bundleContentsLastModifiedTime;
};

%{C++
extern "C"
{
NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowSymlinks, nsILocalFileMac** result);
NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowSymlinks, nsILocalFileMac** result);
}
%}