2006-01-10 23:33:54 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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"
|
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>
|
|
|
|
|
2012-08-14 13:17:34 +04:00
|
|
|
class nsLocalFile MOZ_FINAL : public nsILocalFileWin,
|
|
|
|
public nsIHashable
|
1999-12-04 04:13:44 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
|
|
|
|
|
|
|
nsLocalFile();
|
|
|
|
|
2010-06-10 22:11:11 +04:00
|
|
|
static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
1999-12-04 04:13:44 +03:00
|
|
|
|
|
|
|
// nsISupports interface
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIFile interface
|
|
|
|
NS_DECL_NSIFILE
|
|
|
|
|
|
|
|
// nsILocalFile interface
|
|
|
|
NS_DECL_NSILOCALFILE
|
|
|
|
|
2005-02-25 12:00:45 +03:00
|
|
|
// nsILocalFileWin interface
|
|
|
|
NS_DECL_NSILOCALFILEWIN
|
|
|
|
|
2005-11-18 17:18:49 +03:00
|
|
|
// nsIHashable interface
|
|
|
|
NS_DECL_NSIHASHABLE
|
|
|
|
|
2002-04-27 09:33:09 +04:00
|
|
|
public:
|
|
|
|
static void GlobalInit();
|
|
|
|
static void GlobalShutdown();
|
|
|
|
|
1999-12-04 04:13:44 +03:00
|
|
|
private:
|
2003-07-19 02:14:16 +04:00
|
|
|
nsLocalFile(const nsLocalFile& other);
|
2004-01-15 09:14:18 +03:00
|
|
|
~nsLocalFile() {}
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDirty; // cached information can only be used when this is false
|
2012-02-09 01:48:23 +04:00
|
|
|
bool mResolveDirty;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mFollowSymlinks; // should we follow symlinks when working on this file
|
2000-07-13 03:31:31 +04:00
|
|
|
|
2004-06-17 20:37:25 +04:00
|
|
|
// this string will always be in native format!
|
2006-03-22 07:26:30 +03:00
|
|
|
nsString mWorkingPath;
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2006-03-22 07:26:30 +03:00
|
|
|
// this will be the resolved path of shortcuts, it will *NEVER*
|
|
|
|
// be returned to the user
|
|
|
|
nsString mResolvedPath;
|
|
|
|
|
2006-01-10 23:33:54 +03:00
|
|
|
// this string, if not empty, is the *short* pathname that represents
|
|
|
|
// mWorkingPath
|
2006-03-22 07:26:30 +03:00
|
|
|
nsString mShortWorkingPath;
|
2006-01-10 23:33:54 +03:00
|
|
|
|
2002-04-27 09:33:09 +04:00
|
|
|
PRFileInfo64 mFileInfo64;
|
|
|
|
|
2012-02-09 01:48:23 +04:00
|
|
|
void MakeDirty()
|
|
|
|
{
|
|
|
|
mDirty = true;
|
|
|
|
mResolveDirty = true;
|
|
|
|
mShortWorkingPath.Truncate();
|
|
|
|
}
|
2004-06-17 20:37:25 +04:00
|
|
|
|
|
|
|
nsresult ResolveAndStat();
|
2012-02-09 01:48:23 +04:00
|
|
|
nsresult Resolve();
|
2004-06-17 20:37:25 +04:00
|
|
|
nsresult ResolveShortcut();
|
2006-01-10 23:33:54 +03:00
|
|
|
|
|
|
|
void EnsureShortPath();
|
1999-12-08 02:31:25 +03:00
|
|
|
|
2006-03-22 07:26:30 +03:00
|
|
|
nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool followSymlinks, bool move);
|
2006-03-22 07:26:30 +03:00
|
|
|
nsresult CopySingleFile(nsIFile *source, nsIFile* dest,
|
|
|
|
const nsAString &newName,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool followSymlinks, bool move,
|
|
|
|
bool skipNtfsAclReset = false);
|
1999-12-04 04:13:44 +03:00
|
|
|
|
2006-03-22 07:26:30 +03:00
|
|
|
nsresult SetModDate(PRInt64 aLastModifiedTime, const PRUnichar *filePath);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval);
|
2006-03-22 07:26:30 +03:00
|
|
|
nsresult AppendInternal(const nsAFlatString &node,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool multipleComponents);
|
1999-12-04 04:13:44 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|