Bug 1690340 - Part 4: Insert the "Page Source" before the "Extensions for Developers...
[gecko.git] / xpcom / io / nsLocalFileWin.h
blob7452550a3b2fc8cacaf70af92be485a0842b9497
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 "nsILocalFileWin.h"
16 #include "nsIClassInfoImpl.h"
17 #include "prio.h"
19 #include "mozilla/Attributes.h"
21 #include "windows.h"
22 #include "shlobj.h"
24 #include <sys/stat.h>
26 class nsLocalFile final : public nsILocalFileWin {
27 public:
28 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
30 nsLocalFile();
31 explicit nsLocalFile(const nsAString& aFilePath);
33 static nsresult nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
34 void** aInstancePtr);
36 // nsISupports interface
37 NS_DECL_THREADSAFE_ISUPPORTS
39 // nsIFile interface
40 NS_DECL_NSIFILE
42 // nsILocalFileWin interface
43 NS_DECL_NSILOCALFILEWIN
45 public:
46 // Removes registry command handler parameters, quotes, and expands
47 // environment strings.
48 static bool CleanupCmdHandlerPath(nsAString& aCommandHandler);
49 // Called off the main thread to open the window revealing the file
50 static nsresult RevealFile(const nsString& aResolvedPath);
52 private:
53 // CopyMove and CopySingleFile constants for |options| parameter:
54 enum CopyFileOption {
55 FollowSymlinks = 1u << 0,
56 Move = 1u << 1,
57 SkipNtfsAclReset = 1u << 2,
58 Rename = 1u << 3
61 nsLocalFile(const nsLocalFile& aOther);
62 ~nsLocalFile() {}
64 bool mDirty; // cached information can only be used when this is false
65 bool mResolveDirty;
67 bool mUseDOSDevicePathSyntax;
69 // this string will always be in native format!
70 nsString mWorkingPath;
72 // this will be the resolved path of shortcuts, it will *NEVER*
73 // be returned to the user
74 nsString mResolvedPath;
76 // this string, if not empty, is the *short* pathname that represents
77 // mWorkingPath
78 nsString mShortWorkingPath;
80 PRFileInfo64 mFileInfo64;
82 void MakeDirty() {
83 mDirty = true;
84 mResolveDirty = true;
85 mShortWorkingPath.Truncate();
88 nsresult LookupExtensionIn(const char* const* aExtensionsArray,
89 size_t aArrayLength, bool* aResult);
91 nsresult ResolveAndStat();
92 nsresult Resolve();
93 nsresult ResolveSymlink();
95 void EnsureShortPath();
97 nsresult CopyMove(nsIFile* aNewParentDir, const nsAString& aNewName,
98 uint32_t aOptions);
99 nsresult CopySingleFile(nsIFile* aSource, nsIFile* aDest,
100 const nsAString& aNewName, uint32_t aOptions);
102 nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t* aFilePath);
103 nsresult HasFileAttribute(DWORD aFileAttrib, bool* aResult);
104 nsresult AppendInternal(const nsString& aNode, bool aMultipleComponents);
106 nsresult OpenNSPRFileDescMaybeShareDelete(int32_t aFlags, int32_t aMode,
107 bool aShareDelete,
108 PRFileDesc** aResult);
111 #endif