зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801883 - New profile directories are hidden in Finder. r=josh
This commit is contained in:
Родитель
2d3aa74ecb
Коммит
e364be4527
|
@ -40,12 +40,6 @@
|
|||
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// for chflags()
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -732,16 +726,6 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch)
|
|||
mDiskCacheParentDirectory = do_QueryInterface(directory, &rv);
|
||||
}
|
||||
if (mDiskCacheParentDirectory) {
|
||||
#ifdef XP_MACOSX
|
||||
// ensure that this directory is not indexed by Spotlight
|
||||
// (bug 718910). it may already exist, so we "just do it."
|
||||
nsAutoCString cachePD;
|
||||
if (NS_SUCCEEDED(mDiskCacheParentDirectory->GetNativePath(cachePD))) {
|
||||
if (chflags(cachePD.get(), UF_HIDDEN)) {
|
||||
NS_WARNING("Failed to set CacheParentDirectory to HIDDEN.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bool firstSmartSizeRun;
|
||||
rv = branch->GetBoolPref(DISK_CACHE_SMART_SIZE_FIRST_RUN_PREF,
|
||||
&firstSmartSizeRun);
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
#include "nsILocalFileMac.h"
|
||||
// for chflags()
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef XP_UNIX
|
||||
#include <ctype.h>
|
||||
|
@ -132,6 +135,30 @@ nsXREDirProvider::SetProfile(nsIFile* aDir, nsIFile* aLocalDir)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
bool same;
|
||||
if (NS_SUCCEEDED(aDir->Equals(aLocalDir, &same)) && !same) {
|
||||
// Ensure that the cache directory is not indexed by Spotlight
|
||||
// (bug 718910). At least on OS X, the cache directory (under
|
||||
// ~/Library/Caches/) is always the "local" user profile
|
||||
// directory. This is confusing, since *both* user profile
|
||||
// directories are "local" (they both exist under the user's
|
||||
// home directory). But this usage dates back at least as far
|
||||
// as the patch for bug 291033, where "local" seems to mean
|
||||
// "suitable for temporary storage". Don't hide the cache
|
||||
// directory if by some chance it and the "non-local" profile
|
||||
// directory are the same -- there are bad side effects from
|
||||
// hiding a profile directory under /Library/Application Support/
|
||||
// (see bug 801883).
|
||||
nsAutoCString cacheDir;
|
||||
if (NS_SUCCEEDED(aLocalDir->GetNativePath(cacheDir))) {
|
||||
if (chflags(cacheDir.get(), UF_HIDDEN)) {
|
||||
NS_WARNING("Failed to set Cache directory to HIDDEN.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mProfileDir = aDir;
|
||||
mProfileLocalDir = aLocalDir;
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче