1 /* -*- Mode: C++; tab-width: 2; 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 Communicator client code, released
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.
24 * Doug Turner <dougt@netscape.com>
25 * Brodie Thiesfield <brofield@jellycan.com>
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.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef _nsLocalFileWIN_H_
42 #define _nsLocalFileWIN_H_
49 #include "nsIFactory.h"
50 #include "nsILocalFileWin.h"
51 #include "nsIHashable.h"
52 #include "nsIClassInfoImpl.h"
56 // For older version (<6.0) of the VC Compiler
57 #if (_MSC_VER == 1100)
59 DEFINE_OLEGUID(IID_IPersistFile
, 0x0000010BL
, 0, 0);
66 class nsLocalFile
: public nsILocalFileWin
,
70 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID
)
74 static NS_METHOD
nsLocalFileConstructor(nsISupports
* outer
, const nsIID
& aIID
, void* *aInstancePtr
);
76 // nsISupports interface
82 // nsILocalFile interface
85 // nsILocalFileWin interface
86 NS_DECL_NSILOCALFILEWIN
88 // nsIHashable interface
92 static void GlobalInit();
93 static void GlobalShutdown();
96 nsLocalFile(const nsLocalFile
& other
);
99 PRPackedBool mDirty
; // cached information can only be used when this is PR_FALSE
100 PRPackedBool mFollowSymlinks
; // should we follow symlinks when working on this file
102 // this string will always be in native format!
103 nsString mWorkingPath
;
105 // this will be the resolved path of shortcuts, it will *NEVER*
106 // be returned to the user
107 nsString mResolvedPath
;
109 // this string, if not empty, is the *short* pathname that represents
111 nsString mShortWorkingPath
;
113 PRFileInfo64 mFileInfo64
;
115 void MakeDirty() { mDirty
= PR_TRUE
; mShortWorkingPath
.Truncate(); }
117 nsresult
ResolveAndStat();
118 nsresult
ResolveShortcut();
120 void EnsureShortPath();
122 nsresult
CopyMove(nsIFile
*newParentDir
, const nsAString
&newName
,
123 PRBool followSymlinks
, PRBool move
);
124 nsresult
CopySingleFile(nsIFile
*source
, nsIFile
* dest
,
125 const nsAString
&newName
,
126 PRBool followSymlinks
, PRBool move
);
128 nsresult
SetModDate(PRInt64 aLastModifiedTime
, const PRUnichar
*filePath
);
129 nsresult
HasFileAttribute(DWORD fileAttrib
, PRBool
*_retval
);
130 nsresult
AppendInternal(const nsAFlatString
&node
,
131 PRBool multipleComponents
);