2014-05-05 21:30:43 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-12-04 04:13:44 +03:00
|
|
|
|
|
|
|
#ifndef _nsLocalFileWIN_H_
|
|
|
|
#define _nsLocalFileWIN_H_
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsError.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsIFile.h"
|
|
|
|
#include "nsIFactory.h"
|
2005-02-25 12:00:45 +03:00
|
|
|
#include "nsILocalFileWin.h"
|
2005-11-18 17:18:49 +03:00
|
|
|
#include "nsIHashable.h"
|
2007-07-25 20:53:37 +04:00
|
|
|
#include "nsIClassInfoImpl.h"
|
2013-09-23 21:29:27 +04:00
|
|
|
#include "prio.h"
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2012-08-14 13:17:34 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
1999-12-04 04:13:44 +03:00
|
|
|
#include "windows.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2014-05-15 00:15:46 +04:00
|
|
|
class nsLocalFile final : public nsILocalFileWin, public nsIHashable {
|
1999-12-04 04:13:44 +03:00
|
|
|
public:
|
2014-05-05 21:30:43 +04:00
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
nsLocalFile();
|
2017-12-15 00:53:37 +03:00
|
|
|
explicit nsLocalFile(const nsAString& aFilePath);
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2014-05-15 00:15:46 +04:00
|
|
|
static nsresult nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
|
|
|
|
void** aInstancePtr);
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsISupports interface
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2005-02-25 12:00:45 +03:00
|
|
|
|
2014-05-05 21:30:43 +04:00
|
|
|
// nsIFile interface
|
|
|
|
NS_DECL_NSIFILE
|
|
|
|
|
|
|
|
// nsILocalFileWin interface
|
|
|
|
NS_DECL_NSILOCALFILEWIN
|
|
|
|
|
|
|
|
// nsIHashable interface
|
|
|
|
NS_DECL_NSIHASHABLE
|
2005-11-18 17:18:49 +03:00
|
|
|
|
2002-04-27 09:33:09 +04:00
|
|
|
public:
|
2016-09-30 19:18:41 +03:00
|
|
|
// Removes registry command handler parameters, quotes, and expands
|
|
|
|
// environment strings.
|
|
|
|
static bool CleanupCmdHandlerPath(nsAString& aCommandHandler);
|
|
|
|
|
1999-12-04 04:13:44 +03:00
|
|
|
private:
|
2014-05-05 21:30:43 +04:00
|
|
|
// CopyMove and CopySingleFile constants for |options| parameter:
|
|
|
|
enum CopyFileOption {
|
|
|
|
FollowSymlinks = 1u << 0,
|
|
|
|
Move = 1u << 1,
|
|
|
|
SkipNtfsAclReset = 1u << 2,
|
|
|
|
Rename = 1u << 3
|
|
|
|
};
|
|
|
|
|
2014-05-15 00:15:46 +04:00
|
|
|
nsLocalFile(const nsLocalFile& aOther);
|
|
|
|
~nsLocalFile() {}
|
2014-05-05 21:30:43 +04:00
|
|
|
|
|
|
|
bool mDirty; // cached information can only be used when this is false
|
|
|
|
bool mResolveDirty;
|
|
|
|
bool mFollowSymlinks; // should we follow symlinks when working on this file
|
|
|
|
|
|
|
|
// this string will always be in native format!
|
|
|
|
nsString mWorkingPath;
|
|
|
|
|
|
|
|
// this will be the resolved path of shortcuts, it will *NEVER*
|
|
|
|
// be returned to the user
|
|
|
|
nsString mResolvedPath;
|
|
|
|
|
|
|
|
// this string, if not empty, is the *short* pathname that represents
|
|
|
|
// mWorkingPath
|
|
|
|
nsString mShortWorkingPath;
|
|
|
|
|
|
|
|
PRFileInfo64 mFileInfo64;
|
|
|
|
|
|
|
|
void MakeDirty() {
|
|
|
|
mDirty = true;
|
|
|
|
mResolveDirty = true;
|
|
|
|
mShortWorkingPath.Truncate();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult ResolveAndStat();
|
|
|
|
nsresult Resolve();
|
|
|
|
nsresult ResolveShortcut();
|
|
|
|
|
|
|
|
void EnsureShortPath();
|
|
|
|
|
2014-05-15 00:15:46 +04:00
|
|
|
nsresult CopyMove(nsIFile* aNewParentDir, const nsAString& aNewName,
|
|
|
|
uint32_t aOptions);
|
|
|
|
nsresult CopySingleFile(nsIFile* aSource, nsIFile* aDest,
|
|
|
|
const nsAString& aNewName, uint32_t aOptions);
|
2014-05-05 21:30:43 +04:00
|
|
|
|
2014-05-15 00:15:46 +04:00
|
|
|
nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t* aFilePath);
|
|
|
|
nsresult HasFileAttribute(DWORD aFileAttrib, bool* aResult);
|
2017-06-20 12:19:05 +03:00
|
|
|
nsresult AppendInternal(const nsString& aNode, bool aMultipleComponents);
|
2014-09-27 03:21:57 +04:00
|
|
|
|
|
|
|
nsresult OpenNSPRFileDescMaybeShareDelete(int32_t aFlags, int32_t aMode,
|
|
|
|
bool aShareDelete,
|
|
|
|
PRFileDesc** aResult);
|
1999-12-04 04:13:44 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|