2006-01-10 23:33:54 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-04-18 18:21:17 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-12-04 04:13:44 +03:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-12-04 04:13:44 +03:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-12-04 04:13:44 +03:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The Original Code is Mozilla Communicator client code, released
|
|
|
|
* March 31, 1998.
|
1999-12-04 04:13:44 +03:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998-1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Doug Turner <dougt@netscape.com>
|
2004-06-17 20:37:25 +04:00
|
|
|
* Brodie Thiesfield <brofield@jellycan.com>
|
2004-04-18 18:21:17 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
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
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2005-11-18 17:18:49 +03:00
|
|
|
class nsLocalFile : public nsILocalFileWin,
|
2008-02-02 05:07:49 +03:00
|
|
|
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
|