xpcom/io/nsLocalFileWin.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef _nsLocalFileWIN_H_
     7 #define _nsLocalFileWIN_H_
     9 #include "nscore.h"
    10 #include "nsError.h"
    11 #include "nsString.h"
    12 #include "nsCRT.h"
    13 #include "nsIFile.h"
    14 #include "nsIFactory.h"
    15 #include "nsILocalFileWin.h"
    16 #include "nsIHashable.h"
    17 #include "nsIClassInfoImpl.h"
    18 #include "prio.h"
    20 #include "mozilla/Attributes.h"
    22 #include "windows.h"
    23 #include "shlobj.h"
    25 #include <sys/stat.h>
    27 class nsLocalFile MOZ_FINAL : public nsILocalFileWin,
    28                               public nsIHashable
    29 {
    30 public:
    31     NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
    33     nsLocalFile();
    35     static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
    37     // nsISupports interface
    38     NS_DECL_THREADSAFE_ISUPPORTS
    40     // nsIFile interface
    41     NS_DECL_NSIFILE
    43     // nsILocalFile interface
    44     NS_DECL_NSILOCALFILE
    46     // nsILocalFileWin interface
    47     NS_DECL_NSILOCALFILEWIN
    49     // nsIHashable interface
    50     NS_DECL_NSIHASHABLE
    52 public:
    53     static void GlobalInit();
    54     static void GlobalShutdown();
    56 private:
    57     // CopyMove and CopySingleFile constants for |options| parameter:
    58     enum CopyFileOption {
    59       FollowSymlinks          = 1u << 0,
    60       Move                    = 1u << 1,
    61       SkipNtfsAclReset        = 1u << 2,
    62       Rename                  = 1u << 3
    63     };
    65     nsLocalFile(const nsLocalFile& other);
    66     ~nsLocalFile() {}
    68     bool mDirty;            // cached information can only be used when this is false
    69     bool mResolveDirty;
    70     bool mFollowSymlinks;   // should we follow symlinks when working on this file
    72     // this string will always be in native format!
    73     nsString mWorkingPath;
    75     // this will be the resolved path of shortcuts, it will *NEVER* 
    76     // be returned to the user
    77     nsString mResolvedPath;
    79     // this string, if not empty, is the *short* pathname that represents
    80     // mWorkingPath
    81     nsString mShortWorkingPath;
    83     PRFileInfo64 mFileInfo64;
    85     void MakeDirty() 
    86     { 
    87       mDirty = true;
    88       mResolveDirty = true;
    89       mShortWorkingPath.Truncate();
    90     }
    92     nsresult ResolveAndStat();
    93     nsresult Resolve();
    94     nsresult ResolveShortcut();
    96     void EnsureShortPath();
    98     nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName,
    99                       uint32_t options);
   100     nsresult CopySingleFile(nsIFile *source, nsIFile* dest,
   101                             const nsAString &newName,
   102                             uint32_t options);
   104     nsresult SetModDate(int64_t aLastModifiedTime, const wchar_t *filePath);
   105     nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval);
   106     nsresult AppendInternal(const nsAFlatString &node,
   107                             bool multipleComponents);
   108 };
   110 #endif

mercurial