Back to index

lightning-sunbird  0.9+nobinonly
nsLocalFileWin.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998-1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Doug Turner <dougt@netscape.com>
00025  *   Brodie Thiesfield <brofield@jellycan.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #ifndef _nsLocalFileWIN_H_
00042 #define _nsLocalFileWIN_H_
00043 
00044 #include "nscore.h"
00045 #include "nsError.h"
00046 #include "nsString.h"
00047 #include "nsCRT.h"
00048 #include "nsIFile.h"
00049 #include "nsIFactory.h"
00050 #include "nsILocalFileWin.h"
00051 
00052 #include "windows.h"
00053 
00054 // For older version (<6.0) of the VC Compiler
00055 #if (_MSC_VER == 1100)
00056 #include <objbase.h>
00057 DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
00058 #endif
00059 
00060 #include "shlobj.h"
00061 
00062 #include <sys/stat.h>
00063 
00064 class nsLocalFile : public nsILocalFileWin
00065 {
00066 public:
00067     NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
00068     
00069     nsLocalFile();
00070 
00071     static NS_METHOD nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
00072 
00073     // nsISupports interface
00074     NS_DECL_ISUPPORTS
00075     
00076     // nsIFile interface
00077     NS_DECL_NSIFILE
00078     
00079     // nsILocalFile interface
00080     NS_DECL_NSILOCALFILE
00081 
00082     // nsILocalFileWin interface
00083     NS_DECL_NSILOCALFILEWIN
00084 
00085 public:
00086     static void GlobalInit();
00087     static void GlobalShutdown();
00088 
00089 private:
00090     nsLocalFile(const nsLocalFile& other);
00091     ~nsLocalFile() {}
00092 
00093     PRPackedBool mDirty;            // cached information can only be used when this is PR_FALSE
00094     PRPackedBool mFollowSymlinks;   // should we follow symlinks when working on this file
00095     
00096     // this string will always be in native format!
00097     nsString mWorkingPath;
00098     
00099     // this will be the resolved path of shortcuts, it will *NEVER* 
00100     // be returned to the user
00101     nsString mResolvedPath;
00102 
00103     PRFileInfo64 mFileInfo64;
00104 
00105     void MakeDirty() { mDirty = PR_TRUE; }
00106 
00107     nsresult ResolveAndStat();
00108     nsresult ResolveShortcut();
00109     
00110     nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName,
00111                       PRBool followSymlinks, PRBool move);
00112     nsresult CopySingleFile(nsIFile *source, nsIFile* dest,
00113                             const nsAString &newName,
00114                             PRBool followSymlinks, PRBool move);
00115 
00116     nsresult SetModDate(PRInt64 aLastModifiedTime, const PRUnichar *filePath);
00117     nsresult HasFileAttribute(DWORD fileAttrib, PRBool *_retval);
00118     nsresult AppendInternal(const nsAFlatString &node,
00119                             PRBool multipleComponents);
00120 };
00121 
00122 #endif