1 | /* -*- Mode: C++; tab-width: 2; 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 | * Doug Turner <[email protected]>
|
---|
25 | * Brodie Thiesfield <[email protected]>
|
---|
26 | *
|
---|
27 | * Alternatively, the contents of this file may be used under the terms of
|
---|
28 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
29 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
30 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
31 | * of those above. If you wish to allow use of your version of this file only
|
---|
32 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
33 | * use your version of this file under the terms of the MPL, indicate your
|
---|
34 | * decision by deleting the provisions above and replace them with the notice
|
---|
35 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
36 | * the provisions above, a recipient may use your version of this file under
|
---|
37 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
38 | *
|
---|
39 | * ***** END LICENSE BLOCK ***** */
|
---|
40 |
|
---|
41 | #ifndef _nsLocalFileWIN_H_
|
---|
42 | #define _nsLocalFileWIN_H_
|
---|
43 |
|
---|
44 | #include "nscore.h"
|
---|
45 | #include "nsError.h"
|
---|
46 | #include "nsString.h"
|
---|
47 | #include "nsCRT.h"
|
---|
48 | #include "nsIFile.h"
|
---|
49 | #include "nsIFactory.h"
|
---|
50 |
|
---|
51 | #include "windows.h"
|
---|
52 |
|
---|
53 | // For older version (<6.0) of the VC Compiler
|
---|
54 | #if (_MSC_VER == 1100)
|
---|
55 | #include <objbase.h>
|
---|
56 | DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #include "shlobj.h"
|
---|
60 |
|
---|
61 | #include <sys/stat.h>
|
---|
62 |
|
---|
63 | class nsLocalFile : public nsILocalFile
|
---|
64 | {
|
---|
65 | public:
|
---|
66 | NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
---|
67 |
|
---|
68 | nsLocalFile();
|
---|
69 |
|
---|
70 | static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
---|
71 |
|
---|
72 | // nsISupports interface
|
---|
73 | NS_DECL_ISUPPORTS
|
---|
74 |
|
---|
75 | // nsIFile interface
|
---|
76 | NS_DECL_NSIFILE
|
---|
77 |
|
---|
78 | // nsILocalFile interface
|
---|
79 | NS_DECL_NSILOCALFILE
|
---|
80 |
|
---|
81 | public:
|
---|
82 | static void GlobalInit();
|
---|
83 | static void GlobalShutdown();
|
---|
84 |
|
---|
85 | private:
|
---|
86 | nsLocalFile(const nsLocalFile& other);
|
---|
87 | ~nsLocalFile() {}
|
---|
88 |
|
---|
89 | PRPackedBool mDirty; // cached information can only be used when this is PR_FALSE
|
---|
90 | PRPackedBool mFollowSymlinks; // should we follow symlinks when working on this file
|
---|
91 |
|
---|
92 | // this string will always be in native format!
|
---|
93 | nsCString mWorkingPath;
|
---|
94 |
|
---|
95 | // this will be the resolved path of shortcuts, it will *NEVER* be returned to the user
|
---|
96 | nsCString mResolvedPath;
|
---|
97 |
|
---|
98 | PRFileInfo64 mFileInfo64;
|
---|
99 |
|
---|
100 | void MakeDirty() { mDirty = PR_TRUE; }
|
---|
101 |
|
---|
102 | nsresult ResolveAndStat();
|
---|
103 | nsresult ResolveShortcut();
|
---|
104 |
|
---|
105 | nsresult CopyMove(nsIFile *newParentDir, const nsACString &newName, PRBool followSymlinks, PRBool move);
|
---|
106 | nsresult CopySingleFile(nsIFile *source, nsIFile* dest, const nsACString &newName, PRBool followSymlinks, PRBool move);
|
---|
107 |
|
---|
108 | nsresult SetModDate(PRInt64 aLastModifiedTime, const char *filePath);
|
---|
109 | nsresult HasFileAttribute(DWORD fileAttrib, PRBool *_retval);
|
---|
110 | nsresult AppendNativeInternal(const nsAFlatCString &node, PRBool multipleComponents);
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif
|
---|