Conrad Carlen wrote:

> I have some profile mgr bugs which could all be solved if we had 
> something (I think) we're missing: XP, relative file specs. If we had 
> this, several nifty things could be done:

This would be fantastic!

> (1) On a dual boot system, use the same profile for both OSs.
> (2) When you have several OSs that can share files over a network, like 
> most of us, you could use the same profile on all your machines. Maybe 
> not at the same time, but that's another problem :-/
> (3) Changing the location of your home dir on Unix would not be a problem.
> (4) If the name of your home dir is different between home and work but 
> you'd like to take your profile dir to and fro and a ZIP drive.
> 
> All we need to do this is to have a file descriptor which is not an 
> absolute path, but a relative path. The point to which it's relative 
> would be any location defined by nsIDirectoryService. What we could do 
> is to add methods to nsILocalFile:
> 
> void getRelativeDescriptor(in string fromLocation, out string desc);
> 

Kind of related to this, I'd like to suggest some sort of auto-storing 
of relative filespecs in prefs.js.. i.e. if I my profile root is 
/u/alecf/.mozilla/foo, and I want to store the location of history.dat 
as /u/alecf/.mozilla/foo/history.dat, I think it should appear in the 
preferences as
user_pref("history.file.location", "$ProfileRoot/history.dat");

or something similar... basically if there is a way we can scan the 
prefix of the filepath and automatically replace it with the ProfileRoot 
if the filepath is actually relative to the ProfileRoot..

This would make Location Independence much easier, as well as 
re-locating a profile from one directory to another.

                                                Alec

> Here, fromLocation is a key defined by directory service. What comes out 
> in desc is a string with the key and then a UTF-8 encoded relative path. 
> The relative path is made from the location returned by directory 
> service for fromLocation. If a relative path can't be made (the file is 
> on a different drive from fromLocation), it's an error. The desc can be 
> stored in a registry, prefs, and so on.
> 
> void initWithRelativeDescriptor(in string desc);
> 
> Here, a file will take the desc string, decode it, and initialize itself 
> with it. The way the relative path is written the same on all platforms, 
> using whatever format we decide. The implementation of nsILocalFile on 
> each platform will have to convert this generic relative path into a 
> native relative path.
> 
> Sound useful? Any better ways to do this?
> 
> -Conrad


Reply via email to