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"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
class nsLocalFile : public nsILocalFileWin,
|
2008-02-01 18:07:49 -08:00
|
|
|
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
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
nsresult SetModDate(PRInt64 aLastModifiedTime, const PRUnichar *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
|