Closed Bug 78480 Opened 23 years ago Closed 23 years ago

Can't seem to set the cache directory as of 30042001 build


(Core :: Networking: Cache, defect, P2)

Windows 98





(Reporter: conceptrat+mozilla, Assigned: gordon)



(Whiteboard: PDT+ [verified on branch])


(2 files)

As of the 30042001 build the cache directory doesn't seem to be able to be set
via the prefs.js entry:

user_pref("", "");

It seems to just default to the NewCache directory in the profile directory.

Is this to be a feature.  Would rather be able to specify where the cache
resides.  Like say the temp directory.
over to cache
Assignee: dveditz → gordon
Component: Preferences: Backend → Networking: Cache
QA Contact: sairuh → tever
Found the reason.  I don't know if this is how it's supposed to work, but ...

If you don't set user_pref("browser.enable.cache", true); then the browser uses
the directory "NewCache" under the profile your using.  If you set
user_pref("browser.enable.cache", true); then the cache goes into the directory
specified in user_pref("", ""); and in my case I must
specify "\" as "\\".

Oooops sorry just realised that the user_pref("", "");
 is for the older cache system.  For the new cache system I mean't to say
user_pref("", "");
This all seems very confusing.  I'll try and straighten this up for 0.9.1.
Ever confirmed: true
Target Milestone: --- → mozilla0.9.1
One of the things we need to clean up is to stop using "NewCache" as a directory 
name, and go back to "Cache".
When that's going to happen could you make sure to check the database in the
cache directory just in case someone is using the older caching/mozilla version.
 If so just delete the cache directory contents and start again.  I think this
sounds right.  Trying to help.
related to the cleanup of the profiles.
Keywords: nsbeta1+
Priority: -- → P3
moving to 0.9.2 per PDT triage
Target Milestone: mozilla0.9.1 → mozilla0.9.2
I know this isn't  big deal for most who understand what's going on, but I can't
imagine that too much of a problem to fix it.
It's a real pain if by default the new cache goes to NewCache in your profile
directory and that the Preferences doesn't correctly add the option:
  user_pref("", "...");
and instead adds
  user_pref("", "...");
to set the directory that your cache goes to.
Could this be any simpler?

Anyway fix for now for new builds for the moment is the following:

In your prefs.js file look for:

Should be:
  user_pref("browser.enable.cache", true);

Now in your prefs.js file look for, but don't expect to find it:

Should be:
  user_pref("", "...");
If it's not in there, put it in and replace the ... with the directory that you
want the cache files to go in.

Example, from my computer for build 2001053104:
I think the bug is that we're still using
Yup definitely.  Although I'm not sure if this gets fixed, to use the
"" prefs.js setting, what happens if the new builds of
the browser find the old cache database and files in the directory set in
"".  Hopefully this will just be a matter of check cache
file type if it's old style then delete files in this directory and start
creating new cache files.
*** Bug 85348 has been marked as a duplicate of this bug. ***
Is this related to bug 46490 ?
Only sort of. That bug is related to the UI, this bug is for the cache service
to read the preference properly.
Lets try these on the trunk and if they do well there we can try bringing them 
back in the 0.9.2 branch.
Keywords: nsBranch
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Priority: P3 → P2
*** Bug 87978 has been marked as a duplicate of this bug. ***
Target Milestone: mozilla0.9.3 → mozilla1.0
*** Bug 89664 has been marked as a duplicate of this bug. ***
Things have gotten broken in the last few weeks, now even is being ignored and the default cache directory is
being used in the profile directory.  win32 2001071004 build

user_pref("", "D:\\cache\\Mozilla\\");
user_pref("", "D:\\cache\\Mozilla\\");
I also see this problem.  Even after following the steps earlier in the bug, I
cannot make the cache go anywhere but myprofiledir/Cache/  (nightly 2001071704,
Okay "" is working again under Win32 Build 2001072403,
see my comments further up.  I'm just getting the latest trunk win32 to see if
that's working again.
By the way Build 2001072403 seems quite stable, hopefully the latest trunk will
be too.
nope 2001072808 still defaults to profile directory.
The trunk is no longer using, but rather
"".  This preference indicates the parent directory
that the cache directory will be create in.  We no longer create a directory
named "NewCache", but just simply "Cache".
Are we going for a prefs.js cache entry record for complete obfuscation?

user_pref("", "D:\\cache\\Mozilla\\");
user_pref("", "D:\\cache\\Mozilla\\");
user_pref("", "D:\\cache\\Mozilla\\");

OK, the new pref works, but it now creates a "Cache" directory under the
specified path.  If the pref specifies a path, why add another dir level?
Excellent questions.

We are adding a new preference and new level for the cache directory to avoid
drastic consequences of the simple misunderstanding between "where I want my
cache directory to go" and "what I want my cache directory to be".

Someday we would like to reintroduce UI for setting the location of the cache
directory, and then even more users will be subject to this confusion (not just
those that are comfortable editing their prefs.js files).

By interpreting the preference as the parent of the cache directory, the
consequences of misunderstanding are relatively minor: if the user mistakenly
thinks the pref represents the path of the cache directory, the result is a
cache directory is created one level deeper than expected.

However, interpreting the preference as the path of the cache directory rather
than the parent has much more severe results: if the user mistakenly thinks the
pref represents the parent directory of the cache "I want the cache in my home
directory/system folder/etc.", the disk cache will spew cache files into that
directory, and may even attempt to delete non-cache files as well (clear cache).

That's why it is important to migrate to a new preference and a new interpretation.
perhaps "browser.cache.disk.parent_directory" would be a less confusing name?
Yup.  I'd be hip to that.
Can someone please summarize the situation? What is the current prefs.js syntax
to set the cache location, and does it work on any or all platforms?
In order for the cache to be in a nonstandard place you need to add the
following two lines to your prefs.js file (WinME):

user_pref("browser.enable.cache", true);
user_pref("", "C:\\temp\\mozillacache");

Adjust the path to your needs. Mozilla will create a subdirectory named "Cache"
below the directory you specify.

Methinks I had the problem of being unable to set the cache directory under
Linux. I have no access to a Linux box capable of running mozilla right now. Can
somebody comment on this?
Thanks for the update. This doesn't seem to work on Mac OS X. I tried

user_pref("browser.enable.cache", true);
user_pref("", "HD Name:pathtofolder");

Also tried UNIX-style
user_pref("browser.enable.cache", true);
user_pref("", "/pathtofolder");

Both times the browser continued to use the Cache folder in my profile folder
Blocks: 99142
Gordon/Gagan - This is marked TM1.0. Suggest we nsbranch- it for this round.
Keywords: nsbranchnsbranch+
Target Milestone: mozilla1.0 → mozilla0.9.4
0.9.4 is out the door.
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Comment on attachment 49803 [details] [diff] [review]
Darin's original suggestion used an underscore rather than mixed case.  I like that better.

Attachment #49803 - Flags: superreview+
Comment on attachment 49803 [details] [diff] [review]
Darin's original suggestion used an underscore rather than mixed case.  I like that better.

seems clearer to me to say parent_directory. r=gagan
Attachment #49803 - Flags: review+
check it in today -PDT+
Whiteboard: PDT+
Change checked into trunk and branch.

Mozilla on the Macintosh does not allow you to enter text in preference files to
specify file/directory locations.  nsIFile objects are stored as aliases on the
Mac, so any  code that reads in file location preferences would simply get
confused by a simple pathname.  To enable the feature of specifying the cache
directory on the Mac, we need to have UI - which is covered by another bug (bug

I'm marking this bug fixed.
Closed: 23 years ago
Resolution: --- → FIXED
verified on branch - 

these work:
user_pref("browser.cache.disk.enable", true);
user_pref("browser.cache.disk.capacity", 40000);
user_pref("browser.cache.disk.parent_directory", "d:\\tempcache\\");  

similar for unix except slashes reversed.

Win NT4 2001-09-24-05-0.9.4
Linux rh6 2001-09-24-04-0.9.4
Keywords: vtrunk
Whiteboard: PDT+ → PDT+ [verified on branch]

However, the pref

user_pref("browser.cache.disk.enable", true);

is no longer necessary. Specifying

user_pref("browser.cache.disk.capacity", 40000);
user_pref("browser.cache.disk.parent_directory", "/tmp/mozcache");

is sufficient.

BTW, I have posted a patch for bug 46490 to add the UI for this feature into the
prefs panel. Go check it out and give it a review!
verified on Win98, therefore marking VERIFIED.

I used the prefs
user_pref("browser.cache.disk.capacity", 40000);
user_pref("browser.cache.disk.parent_directory", "d:\\tempcache\\");  

the following is no longer necessary

user_pref("browser.cache.disk.enable", true);

Can someone try to verify this on a Mac? That would be very helpful for me since
I am trying to come up with a GUI for this in bug 46490. I have it working on
Linux and Windows, Mac is more difficult, especially since I do not have one to
test this on. Does this work at all on a Mac?
*** Bug 106099 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.