michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _nsLocalFileWIN_H_ michael@0: #define _nsLocalFileWIN_H_ michael@0: michael@0: #include "nscore.h" michael@0: #include "nsError.h" michael@0: #include "nsString.h" michael@0: #include "nsCRT.h" michael@0: #include "nsIFile.h" michael@0: #include "nsIFactory.h" michael@0: #include "nsILocalFileWin.h" michael@0: #include "nsIHashable.h" michael@0: #include "nsIClassInfoImpl.h" michael@0: #include "prio.h" michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #include "windows.h" michael@0: #include "shlobj.h" michael@0: michael@0: #include michael@0: michael@0: class nsLocalFile MOZ_FINAL : public nsILocalFileWin, michael@0: public nsIHashable michael@0: { michael@0: public: michael@0: NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID) michael@0: michael@0: nsLocalFile(); michael@0: michael@0: static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); michael@0: michael@0: // nsISupports interface michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: // nsIFile interface michael@0: NS_DECL_NSIFILE michael@0: michael@0: // nsILocalFile interface michael@0: NS_DECL_NSILOCALFILE michael@0: michael@0: // nsILocalFileWin interface michael@0: NS_DECL_NSILOCALFILEWIN michael@0: michael@0: // nsIHashable interface michael@0: NS_DECL_NSIHASHABLE michael@0: michael@0: public: michael@0: static void GlobalInit(); michael@0: static void GlobalShutdown(); michael@0: michael@0: private: michael@0: // CopyMove and CopySingleFile constants for |options| parameter: michael@0: enum CopyFileOption { michael@0: FollowSymlinks = 1u << 0, michael@0: Move = 1u << 1, michael@0: SkipNtfsAclReset = 1u << 2, michael@0: Rename = 1u << 3 michael@0: }; michael@0: michael@0: nsLocalFile(const nsLocalFile& other); michael@0: ~nsLocalFile() {} michael@0: michael@0: bool mDirty; // cached information can only be used when this is false michael@0: bool mResolveDirty; michael@0: bool mFollowSymlinks; // should we follow symlinks when working on this file michael@0: michael@0: // this string will always be in native format! michael@0: nsString mWorkingPath; michael@0: michael@0: // this will be the resolved path of shortcuts, it will *NEVER* michael@0: // be returned to the user michael@0: nsString mResolvedPath; michael@0: michael@0: // this string, if not empty, is the *short* pathname that represents michael@0: // mWorkingPath michael@0: nsString mShortWorkingPath; michael@0: michael@0: PRFileInfo64 mFileInfo64; michael@0: michael@0: void MakeDirty() michael@0: { michael@0: mDirty = true; michael@0: mResolveDirty = true; michael@0: mShortWorkingPath.Truncate(); michael@0: } michael@0: michael@0: nsresult ResolveAndStat(); michael@0: nsresult Resolve(); michael@0: nsresult ResolveShortcut(); michael@0: michael@0: void EnsureShortPath(); michael@0: michael@0: nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName, michael@0: uint32_t options); michael@0: nsresult CopySingleFile(nsIFile *source, nsIFile* dest, michael@0: const nsAString &newName, michael@0: uint32_t options); michael@0: michael@0: nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t *filePath); michael@0: nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval); michael@0: nsresult AppendInternal(const nsAFlatString &node, michael@0: bool multipleComponents); michael@0: }; michael@0: michael@0: #endif