From 08b307ced9f38b758d1fc79c0948f17508c87eb7 Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Wed, 24 Nov 2010 02:12:40 +0000 Subject: Revert 67191 - chrome_paths: refactor and sanitize cache directory handling [Checking to see if this build failures on Windows.] Previously we had a bunch of logic in profile_impl.cc that computed where the cache directory lives. This change relocates it to chrome_paths.cc. Some background on cache directories. There are two possible places to store cache files: 1) in the user data directory 2) in an OS-specific user cache directory On Windows, we always pick (1). On Mac and Linux, we currently use (2) in some circumstances. This patch changes both Mac and Linux to have the same behavior with respect to (2). The Mac/Linux shared behavior is that if the profile directory is in the standard location for profiles, we put the cache files into a matching directory name in the standard system cache directory (e.g. on Linux if you're using ~/.config/google-chrome, your cache ends up in ~/.cache/google-chrome; on Mac, the directories are ~/Library/Application Support versus ~/Library/Caches). If your user data directory is not in the standard location, we use behavior (1). The semantic changes of this patch should be: - On Mac, previously we checked whether the (2) directory had some particular subdirectories already when picking which one to use. This was removed; which directory is used is solely a question of whether the profile directory is in the standard location. I think the previous behavior was unpredictable. - On Linux, previously we only used behavior (2) if you hadn't changed your user-data-directory at all. Now, to match Mac, as long as your user-data-dir is in the standard place, you use the system cache dir. So e.g. using ~/.config/foobar puts your cache in ~/.cache/foobar. - On Linux, previously the default cache would end up as directories under ~/.cache/google-chrome/; now it ends up as directories under ~/.cache/google-chrome/Default/. (In all instances above, on Linux we continue to obey $XDG_CACHE_HOME.) BUG=59824 TEST=New test ChromePaths.UserCacheDir Review URL: http://codereview.chromium.org/5123004 TBR=evan@chromium.org Review URL: http://codereview.chromium.org/5344003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67201 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/chrome_paths_mac.mm | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'chrome/common/chrome_paths_mac.mm') diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm index 57ed3bd..b87b397 100644 --- a/chrome/common/chrome_paths_mac.mm +++ b/chrome/common/chrome_paths_mac.mm @@ -48,28 +48,6 @@ bool GetUserDocumentsDirectory(FilePath* result) { return mac_util::GetUserDirectory(NSDocumentDirectory, result); } -void GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) { - // If the profile directory is under ~/Library/Application Support, - // use a suitable cache directory under ~/Library/Caches. For - // example, a profile directory of ~/Library/Application - // Support/Google/Chrome/MyProfileName would use the cache directory - // ~/Library/Caches/Google/Chrome/MyProfileName. - - // Default value in cases where any of the following fails. - *result = profile_dir; - - FilePath app_data_dir; - if (!PathService::Get(base::DIR_APP_DATA, &app_data_dir)) - return; - FilePath cache_dir; - if (!PathService::Get(base::DIR_CACHE, &cache_dir)) - return; - if (!app_data_dir.AppendRelativePath(profile_dir, &cache_dir)) - return; - - *result = cache_dir; -} - bool GetUserDownloadsDirectory(FilePath* result) { return mac_util::GetUserDirectory(NSDownloadsDirectory, result); } -- cgit v1.1