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_
15 #include "nsILocalFileWin.h"
16 #include "nsIClassInfoImpl.h"
19 #include "mozilla/Attributes.h"
26 class nsLocalFile final
: public nsILocalFileWin
{
28 NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID
)
31 explicit nsLocalFile(const nsAString
& aFilePath
);
33 static nsresult
nsLocalFileConstructor(nsISupports
* aOuter
, const nsIID
& aIID
,
36 // nsISupports interface
37 NS_DECL_THREADSAFE_ISUPPORTS
42 // nsILocalFileWin interface
43 NS_DECL_NSILOCALFILEWIN
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
);
53 // CopyMove and CopySingleFile constants for |options| parameter:
55 FollowSymlinks
= 1u << 0,
57 SkipNtfsAclReset
= 1u << 2,
61 nsLocalFile(const nsLocalFile
& aOther
);
64 bool mDirty
; // cached information can only be used when this is false
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
78 nsString mShortWorkingPath
;
80 PRFileInfo64 mFileInfo64
;
85 mShortWorkingPath
.Truncate();
88 nsresult
LookupExtensionIn(const char* const* aExtensionsArray
,
89 size_t aArrayLength
, bool* aResult
);
91 nsresult
ResolveAndStat();
93 nsresult
ResolveSymlink();
95 void EnsureShortPath();
97 nsresult
CopyMove(nsIFile
* aNewParentDir
, const nsAString
& aNewName
,
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
,
108 PRFileDesc
** aResult
);