/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"nsAppFileLocationProvider.h" #include"nsAppDirectoryServiceDefs.h" #include"nsDirectoryServiceDefs.h" #include"nsEnumeratorUtils.h" #include"nsAtom.h" #include"nsIDirectoryService.h" #include"nsIFile.h" #include"nsString.h" #include"nsSimpleEnumerator.h" #include"prenv.h" #include"nsCRT.h" #ifdefined(MOZ_WIDGET_COCOA) # include <Carbon/Carbon.h> # include "CocoaFileUtils.h" # include "nsILocalFileMac.h" #elifdefined(XP_WIN) # include <windows.h> # include <shlobj.h> #elifdefined(XP_UNIX) # include <unistd.h> # include <stdlib.h> # include <sys/param.h> #endif
// WARNING: These hard coded names need to go away. They need to // come from localizable resources
if (!mMozBinDirectory) { // Get the mozilla bin directory // 1. Check the directory service first for NS_XPCOM_CURRENT_PROCESS_DIR // This will be set if a directory was passed to NS_InitXPCOM // 2. If that doesn't work, set it to be the current process directory
nsCOMPtr<nsIProperties> directoryService(
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); if (NS_FAILED(rv)) { return rv;
}
if (NS_SUCCEEDED(rv) && !exists) {
rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
}
if (NS_FAILED(rv)) { return rv;
}
localDir.forget(aLocalFile);
return rv;
}
//---------------------------------------------------------------------------------------- // GetDefaultUserProfileRoot - Gets the directory which contains each user // profile dir // // UNIX : ~/.mozilla/ // WIN : <Application Data folder on user's machine>\Mozilla\Profiles // Mac : :Documents:Mozilla:Profiles: //----------------------------------------------------------------------------------------
nsresult nsAppFileLocationProvider::GetDefaultUserProfileRoot(
nsIFile** aLocalFile, bool aLocal) { if (NS_WARN_IF(!aLocalFile)) { return NS_ERROR_INVALID_ARG;
}
nsresult rv;
nsCOMPtr<nsIFile> localDir;
rv = GetProductDirectory(getter_AddRefs(localDir), aLocal); if (NS_FAILED(rv)) { return rv;
}
#ifdefined(MOZ_WIDGET_COCOA) || defined(XP_WIN) // These 3 platforms share this part of the path - do them as one
rv = localDir->AppendRelativeNativePath("Profiles"_ns); if (NS_FAILED(rv)) { return rv;
}
class nsAppDirectoryEnumerator : public nsSimpleEnumerator { public: /** * aKeyList is a null-terminated list of properties which are provided by * aProvider They do not need to be publicly defined keys.
*/
nsAppDirectoryEnumerator(nsIDirectoryServiceProvider* aProvider, constchar* aKeyList[])
: mProvider(aProvider), mCurrentKey(aKeyList) {}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.