2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07: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"
|
|
|
|
#include "nsILocalFileWin.h"
|
|
|
|
#include "nsIHashable.h"
|
2007-07-25 09:53:37 -07:00
|
|
|
#include "nsIClassInfoImpl.h"
|
2013-09-23 10:29:27 -07:00
|
|
|
#include "prio.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-14 02:17:34 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "windows.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2012-08-14 02:17:34 -07:00
|
|
|
class nsLocalFile MOZ_FINAL : public nsILocalFileWin,
|
|
|
|
public nsIHashable
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
|
|
|
|
|
|
|
nsLocalFile();
|
|
|
|
|
2010-06-10 11:11:11 -07:00
|
|
|
static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsISupports interface
|
2013-07-18 19:31:26 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIFile interface
|
|
|
|
NS_DECL_NSIFILE
|
|
|
|
|
|
|
|
// nsILocalFile interface
|
|
|
|
NS_DECL_NSILOCALFILE
|
|
|
|
|
|
|
|
// nsILocalFileWin interface
|
|
|
|
NS_DECL_NSILOCALFILEWIN
|
|
|
|
|
|
|
|
// nsIHashable interface
|
|
|
|
NS_DECL_NSIHASHABLE
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void GlobalInit();
|
|
|
|
static void GlobalShutdown();
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsLocalFile(const nsLocalFile& other);
|
|
|
|
~nsLocalFile() {}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDirty; // cached information can only be used when this is false
|
2012-02-08 13:48:23 -08:00
|
|
|
bool mResolveDirty;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mFollowSymlinks; // should we follow symlinks when working on this file
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
2012-02-08 13:48:23 -08:00
|
|
|
void MakeDirty()
|
|
|
|
{
|
|
|
|
mDirty = true;
|
|
|
|
mResolveDirty = true;
|
|
|
|
mShortWorkingPath.Truncate();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult ResolveAndStat();
|
2012-02-08 13:48:23 -08:00
|
|
|
nsresult Resolve();
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ResolveShortcut();
|
|
|
|
|
|
|
|
void EnsureShortPath();
|
|
|
|
|
|
|
|
nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool followSymlinks, bool move);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult CopySingleFile(nsIFile *source, nsIFile* dest,
|
|
|
|
const nsAString &newName,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool followSymlinks, bool move,
|
|
|
|
bool skipNtfsAclReset = false);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-02-06 08:42:58 -08:00
|
|
|
nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t *filePath);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult AppendInternal(const nsAFlatString &node,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool multipleComponents);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|