Bumping manifests a=b2g-bump
[gecko.git] / xpcom / io / nsLocalFileWin.h
blobba76a3f2558c901a086ebd38423e2c6ff3d68ea9
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _nsLocalFileWIN_H_
8 #define _nsLocalFileWIN_H_
10 #include "nscore.h"
11 #include "nsError.h"
12 #include "nsString.h"
13 #include "nsCRT.h"
14 #include "nsIFile.h"
15 #include "nsIFactory.h"
16 #include "nsILocalFileWin.h"
17 #include "nsIHashable.h"
18 #include "nsIClassInfoImpl.h"
19 #include "prio.h"
21 #include "mozilla/Attributes.h"
23 #include "windows.h"
24 #include "shlobj.h"
26 #include <sys/stat.h>
28 class nsLocalFile MOZ_FINAL
29 : public nsILocalFileWin
30 , public nsIHashable
32 public:
33 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
35 nsLocalFile();
37 static nsresult nsLocalFileConstructor(nsISupports* aOuter,
38 const nsIID& aIID,
39 void** aInstancePtr);
41 // nsISupports interface
42 NS_DECL_THREADSAFE_ISUPPORTS
44 // nsIFile interface
45 NS_DECL_NSIFILE
47 // nsILocalFile interface
48 NS_DECL_NSILOCALFILE
50 // nsILocalFileWin interface
51 NS_DECL_NSILOCALFILEWIN
53 // nsIHashable interface
54 NS_DECL_NSIHASHABLE
56 public:
57 static void GlobalInit();
58 static void GlobalShutdown();
60 private:
61 // CopyMove and CopySingleFile constants for |options| parameter:
62 enum CopyFileOption {
63 FollowSymlinks = 1u << 0,
64 Move = 1u << 1,
65 SkipNtfsAclReset = 1u << 2,
66 Rename = 1u << 3
69 nsLocalFile(const nsLocalFile& aOther);
70 ~nsLocalFile()
74 bool mDirty; // cached information can only be used when this is false
75 bool mResolveDirty;
76 bool mFollowSymlinks; // should we follow symlinks when working on this file
78 // this string will always be in native format!
79 nsString mWorkingPath;
81 // this will be the resolved path of shortcuts, it will *NEVER*
82 // be returned to the user
83 nsString mResolvedPath;
85 // this string, if not empty, is the *short* pathname that represents
86 // mWorkingPath
87 nsString mShortWorkingPath;
89 PRFileInfo64 mFileInfo64;
91 void MakeDirty()
93 mDirty = true;
94 mResolveDirty = true;
95 mShortWorkingPath.Truncate();
98 nsresult ResolveAndStat();
99 nsresult Resolve();
100 nsresult ResolveShortcut();
102 void EnsureShortPath();
104 nsresult CopyMove(nsIFile* aNewParentDir, const nsAString& aNewName,
105 uint32_t aOptions);
106 nsresult CopySingleFile(nsIFile* aSource, nsIFile* aDest,
107 const nsAString& aNewName, uint32_t aOptions);
109 nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t* aFilePath);
110 nsresult HasFileAttribute(DWORD aFileAttrib, bool* aResult);
111 nsresult AppendInternal(const nsAFlatString& aNode,
112 bool aMultipleComponents);
115 #endif