1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
---|
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 Communicator client code, released
|
---|
16 | * March 31, 1998.
|
---|
17 | *
|
---|
18 | * The Initial Developer of the Original Code is
|
---|
19 | * Netscape Communications Corporation.
|
---|
20 | * Portions created by the Initial Developer are Copyright (C) 1998-1999
|
---|
21 | * the Initial Developer. All Rights Reserved.
|
---|
22 | *
|
---|
23 | * Contributor(s):
|
---|
24 | * Steve Dagley <[email protected]>
|
---|
25 | *
|
---|
26 | * Alternatively, the contents of this file may be used under the terms of
|
---|
27 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
28 | * or 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 | #ifndef _nsLocalFileMAC_H_
|
---|
41 | #define _nsLocalFileMAC_H_
|
---|
42 |
|
---|
43 | #include "nscore.h"
|
---|
44 | #include "nsError.h"
|
---|
45 | #include "nsString.h"
|
---|
46 | #include "nsCRT.h"
|
---|
47 | #include "nsIFile.h"
|
---|
48 | #include "nsILocalFileMac.h"
|
---|
49 | #include "nsIFactory.h"
|
---|
50 |
|
---|
51 | #include <Processes.h>
|
---|
52 |
|
---|
53 | class NS_COM nsLocalFile : public nsILocalFileMac
|
---|
54 | {
|
---|
55 | public:
|
---|
56 | NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
---|
57 |
|
---|
58 | nsLocalFile();
|
---|
59 |
|
---|
60 | static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
---|
61 |
|
---|
62 | // nsISupports interface
|
---|
63 | NS_DECL_ISUPPORTS
|
---|
64 |
|
---|
65 | // nsIFile interface
|
---|
66 | NS_DECL_NSIFILE
|
---|
67 |
|
---|
68 | // nsILocalFile interface
|
---|
69 | NS_DECL_NSILOCALFILE
|
---|
70 |
|
---|
71 | // nsILocalFileMac interface
|
---|
72 | NS_DECL_NSILOCALFILEMAC
|
---|
73 |
|
---|
74 | public:
|
---|
75 |
|
---|
76 | static void GlobalInit();
|
---|
77 | static void GlobalShutdown();
|
---|
78 |
|
---|
79 | private:
|
---|
80 | ~nsLocalFile() {}
|
---|
81 |
|
---|
82 | protected:
|
---|
83 | void MakeDirty();
|
---|
84 | nsresult ResolveAndStat();
|
---|
85 | nsresult UpdateCachedCatInfo(PRBool forceUpdate);
|
---|
86 |
|
---|
87 | nsresult FindAppOnLocalVolumes(OSType sig, FSSpec &outSpec);
|
---|
88 |
|
---|
89 | nsresult FindRunningAppBySignature(OSType sig, FSSpec& outSpec, ProcessSerialNumber& outPsn);
|
---|
90 | nsresult FindRunningAppByFSSpec(const FSSpec& appSpec, ProcessSerialNumber& outPsn);
|
---|
91 |
|
---|
92 | nsresult MyLaunchAppWithDoc(const FSSpec& appSpec, const FSSpec* aDocToLoad, PRBool aLaunchInBackground);
|
---|
93 |
|
---|
94 | nsresult TestFinderFlag(PRUint16 flagMask, PRBool *outFlagSet, PRBool testTargetSpec = PR_TRUE);
|
---|
95 |
|
---|
96 | nsresult MoveCopy( nsIFile* newParentDir, const nsACString &newName, PRBool isCopy, PRBool followLinks );
|
---|
97 |
|
---|
98 | // Passing nsnull for the extension uses leaf name
|
---|
99 | nsresult SetOSTypeAndCreatorFromExtension(const char* extension = nsnull);
|
---|
100 |
|
---|
101 | nsresult ExtensionIsOnExceptionList(const char *extension, PRBool *onList);
|
---|
102 |
|
---|
103 | private:
|
---|
104 | nsLocalFile(const nsLocalFile& srcFile);
|
---|
105 | nsLocalFile(const FSSpec& aSpec, const nsACString& aAppendedPath);
|
---|
106 |
|
---|
107 | // Copies all members except mRefCnt, copies mCachedCatInfo only if it's valid.
|
---|
108 | nsLocalFile& operator=(const nsLocalFile& rhs);
|
---|
109 |
|
---|
110 | PRPackedBool mFollowLinks;
|
---|
111 | PRPackedBool mFollowLinksDirty;
|
---|
112 |
|
---|
113 | // The object we specify is always: mSpec + mAppendedPath.
|
---|
114 | // mSpec is a valid spec in that its parent is known to exist.
|
---|
115 | // Appending nodes with Append() will update mSpec immediately
|
---|
116 | // if the appended node exists. If not, appended nodes are stored
|
---|
117 | // in mAppendedPath.
|
---|
118 |
|
---|
119 | PRPackedBool mSpecDirty;
|
---|
120 | FSSpec mSpec;
|
---|
121 | nsCString mAppendedPath;
|
---|
122 | FSSpec mTargetSpec; // If mSpec is an alias, this is the resolved alias.
|
---|
123 |
|
---|
124 | CInfoPBRec mCachedCatInfo; // cached file info, for the GetFSSpec() spec
|
---|
125 | PRPackedBool mCatInfoDirty; // does this need to be updated?
|
---|
126 |
|
---|
127 | OSType mType, mCreator;
|
---|
128 |
|
---|
129 | static void InitClassStatics();
|
---|
130 |
|
---|
131 | static OSType sCurrentProcessSignature;
|
---|
132 | static PRBool sHasHFSPlusAPIs;
|
---|
133 | static PRBool sRunningOSX;
|
---|
134 | };
|
---|
135 |
|
---|
136 | #endif
|
---|
137 |
|
---|