1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/io/nsDirectoryServiceUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsDirectoryServiceUtils_h___ 1.10 +#define nsDirectoryServiceUtils_h___ 1.11 + 1.12 +#include "nsIServiceManager.h" 1.13 +#include "nsIProperties.h" 1.14 +#include "nsServiceManagerUtils.h" 1.15 +#include "nsCOMPtr.h" 1.16 +#include "nsXPCOMCID.h" 1.17 +#include "nsIFile.h" 1.18 + 1.19 +inline nsresult 1.20 +NS_GetSpecialDirectory(const char* specialDirName, nsIFile* *result) 1.21 +{ 1.22 + nsresult rv; 1.23 + nsCOMPtr<nsIProperties> serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); 1.24 + if (NS_FAILED(rv)) 1.25 + return rv; 1.26 + 1.27 + return serv->Get(specialDirName, NS_GET_IID(nsIFile), 1.28 + reinterpret_cast<void**>(result)); 1.29 +} 1.30 + 1.31 +#endif