From d92e35fc406b93046f3c14929bd69b91e03d56e5 Mon Sep 17 00:00:00 2001 From: "mcmullen%netscape.com" Date: Tue, 15 Jun 1999 05:18:04 +0000 Subject: [PATCH] Added inline convenience methods. --- xpfe/appshell/public/nsIFileLocator.idl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xpfe/appshell/public/nsIFileLocator.idl b/xpfe/appshell/public/nsIFileLocator.idl index c5317896f29b..6cdbfb085f68 100644 --- a/xpfe/appshell/public/nsIFileLocator.idl +++ b/xpfe/appshell/public/nsIFileLocator.idl @@ -19,6 +19,7 @@ %{ C++ #include "nscore.h" +#include "nsIServiceManager.h" %} #include "nsISupports.idl" @@ -48,5 +49,23 @@ interface nsIFileLocator : nsISupports #define NS_FILELOCATOR_PROGID \ "component://netscape/filelocator" +// Factory method used in NSGetFactory for appshell. +extern "C" NS_APPSHELL nsresult +NS_NewFileLocatorFactory(nsIFactory** aFactory); + +// Mostly, all you want to do is this: +inline nsIFileSpec* NS_LocateFileOrDirectory(PRUint32 selector) +{ + nsresult rv; + nsIFileSpec* spec = nsnull; + NS_WITH_SERVICE(nsIFileLocator, locator, NS_FILELOCATOR_PROGID, &rv); + if (NS_SUCCEEDED(rv) && locator) + { + rv = locator->GetFileLocation(selector, &spec); + NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: File locator cannot locate file."); + } + return spec; +} + %}