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