[Jslib] Re: file.js and invalid windows paths

Eric Plaster plaster@talkware.net
Tue, 08 May 2001 10:41:00 -0500


--------------405D93D7FE770EA32A311B79
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

pete collins wrote:

> > > MozUserHomeDir()
> > > MozHomeDir()
> > > ChromeDir()
> > > PrefsDir()
> >
> > Call me old school, but I would prefer something like:
> >
> >    * dir.resetToHomeDir();
> >    * dir.resetChromeDir();
> >    * dir.resetPrefsDir();
>
> Shouldn't these be properties of the class that implement these member
> methods?
>
> Something like:
>
> MozUserHomeDir : this.resetToHomeDir(),
> MozHomeDir     : this.resetChromeDir(),
>
> etc . . .
>
> Then we can use it like:
>
> var path=dir.MozUserHomeDir;

This would, if I'm understanding martin correctly, be in the dirUtils.js.
The dir.js would be more like this:

var dir = new Dir("/tmp");
dir.resetToHomeDir();
var files = dir.files();

Each of the files in the array should probably be File.  Then you could
querry it for its nsIFile object if you want it.

>
>
> It would also be nice if these libraries have a method to return an
> nsIFile object.
>
> so we could do:
>
> dirObj=dir.nsIFile(dir.MozUserHomeDir);
>
> which would return a file object.
>
> io.js has it and i think file.js might also . . .?

Ya, think we should have a nsIFile method for both Dir and File.  But it
should be more like this:

var dir = new Dir("/tmp");
var obj = dir.nsIFile();

>
>
> I use it all the time because many interfaces like to have args that are
> of type nsIFIle.
>
> 2c
>
> --pete

--
----
Eric Plaster                    Universal Talkware Corp
Senior Software Engineer        (612)843-6711
plaster@talkware.net            http://www.talkware.net



--------------405D93D7FE770EA32A311B79
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
pete collins wrote:
<blockquote TYPE=CITE>> > MozUserHomeDir()
<br>> > MozHomeDir()
<br>> > ChromeDir()
<br>> > PrefsDir()
<br>>
<br>> Call me old school, but I would prefer something like:
<br>>
<br>>&nbsp;&nbsp;&nbsp; * dir.resetToHomeDir();
<br>>&nbsp;&nbsp;&nbsp; * dir.resetChromeDir();
<br>>&nbsp;&nbsp;&nbsp; * dir.resetPrefsDir();
<p>Shouldn't these be properties of the class that implement these member
<br>methods?
<p>Something like:
<p>MozUserHomeDir : this.resetToHomeDir(),
<br>MozHomeDir&nbsp;&nbsp;&nbsp;&nbsp; : this.resetChromeDir(),
<p>etc . . .
<p>Then we can use it like:
<p>var path=dir.MozUserHomeDir;</blockquote>
This would, if I'm understanding martin correctly, be in the dirUtils.js.&nbsp;
The dir.js would be more like this:
<p><tt>var dir = new Dir("/tmp");</tt>
<br><tt>dir.resetToHomeDir();</tt>
<br><tt>var files = dir.files();</tt>
<p>Each of the files in the array should probably be File.&nbsp; Then you
could querry it for its nsIFile object if you want it.
<blockquote TYPE=CITE>&nbsp;
<p>It would also be nice if these libraries have a method to return an
<br>nsIFile object.
<p>so we could do:
<p>dirObj=dir.nsIFile(dir.MozUserHomeDir);
<p>which would return a file object.
<p>io.js has it and i think file.js might also . . .?</blockquote>
Ya, think we should have a nsIFile method for both Dir and File.&nbsp;
But it should be more like this:
<p><tt>var dir = new Dir("/tmp");</tt>
<br><tt>var obj = dir.nsIFile();</tt>
<blockquote TYPE=CITE>&nbsp;
<p>I use it all the time because many interfaces like to have args that
are
<br>of type nsIFIle.
<p>2c
<p>--pete</blockquote>

<pre>--&nbsp;
----
Eric Plaster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Universal Talkware Corp
Senior Software Engineer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (612)843-6711
plaster@talkware.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="http://www.talkware.net">http://www.talkware.net</A></pre>
&nbsp;</html>

--------------405D93D7FE770EA32A311B79--