From 4d6ba6c5fa26fa41c9b72be37b1dc9d08938996c Mon Sep 17 00:00:00 2001 From: "racham%netscape.com" Date: Sat, 12 Jun 1999 00:42:38 +0000 Subject: [PATCH] Method to forget the existing profile dir --- xpfe/appshell/public/nsIFileLocator.h | 57 --------------------------- xpfe/appshell/src/nsFileLocations.cpp | 18 ++++++++- 2 files changed, 17 insertions(+), 58 deletions(-) diff --git a/xpfe/appshell/public/nsIFileLocator.h b/xpfe/appshell/public/nsIFileLocator.h index b75feebea6b..e69de29bb2d 100644 --- a/xpfe/appshell/public/nsIFileLocator.h +++ b/xpfe/appshell/public/nsIFileLocator.h @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (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/NPL/ - * - * 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. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are Copyright (C) 1998 - * Netscape Communications Corporation. All Rights Reserved. - */ - -#ifndef nsIFileLocator_h__ -#define nsIFileLocator_h__ - -#include "nsISupports.h" -#include "nscore.h" -#include "prtypes.h" - -/* Forward declarations... */ -class nsIFactory; -class nsFileSpec; - -// {7e44eb01-e600-11d2-915f-f08a208628fc} -#define NS_IFILELOCATOR_IID \ -{ 0x7e44eb01, 0xe600, 0x11d2, \ - {0x91, 0x5f, 0xf0, 0x8a, 0x20, 0x86, 0x28, 0xfc} } - -// {78043e01-e603-11d2-915f-f08a208628fc} -#define NS_FILELOCATOR_CID \ -{ 0x78043e01, 0xe603, 0x11d2, \ - {0x91, 0x5f, 0xf0, 0x8a, 0x20, 0x86, 0x28, 0xfc} } - - -class nsIFileLocator : public nsISupports -{ -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILELOCATOR_IID) - - NS_IMETHOD GetFileLocation( - PRUint32 aType, - // NOTE: actually nsSpecialFileSpec:Type, see nsFileLocations.h. Declared as - // PRUint32 to make it ugly enough for COM use. - nsFileSpec* outSpec) = 0; -}; - -extern "C" NS_APPSHELL nsresult -NS_NewFileLocatorFactory(nsIFactory** aFactory); - -#endif /* nsIFileLocator_h__ */ diff --git a/xpfe/appshell/src/nsFileLocations.cpp b/xpfe/appshell/src/nsFileLocations.cpp index 6f1fca7aaae..89048753650 100644 --- a/xpfe/appshell/src/nsFileLocations.cpp +++ b/xpfe/appshell/src/nsFileLocations.cpp @@ -57,6 +57,9 @@ static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); // for profile manager static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); +// Global variable for gProfileDir +static nsFileSpec* gProfileDir = nsnull; + #ifdef XP_MAC #pragma export on #endif @@ -116,7 +119,7 @@ static void GetProfileDirectory(nsFileSpec& outSpec) // CreateDefaultProfileDirectorySpec() above. //---------------------------------------------------------------------------------------- { - static nsFileSpec* gProfileDir = nsnull; + //static nsFileSpec* gProfileDir = nsnull; // pointer so that we can detect whether it has been initialized if (!gProfileDir) { @@ -383,6 +386,8 @@ public: PRUint32 aType, // NOTE: actually nsSpecialFileSpec:Type, see nsFileLocations.h nsFileSpec* outSpec); + NS_IMETHOD ForgetProfileDir(); + protected: virtual ~nsFileLocator(); @@ -423,6 +428,17 @@ NS_IMETHODIMP nsFileLocator::GetFileLocation( return NS_OK; } +//---------------------------------------------------------------------------------------- +NS_IMETHODIMP nsFileLocator::ForgetProfileDir() +//---------------------------------------------------------------------------------------- +{ + + delete gProfileDir; + gProfileDir = nsnull; + + return NS_OK; +} + //---------------------------------------------------------------------------------------- NS_EXPORT nsresult NS_NewFileLocator(nsIFileLocator** aResult) //----------------------------------------------------------------------------------------