[Jslib] Problem with File.open('w')

Sudhakar Chandra thaths at openscroll.org
Mon Aug 2 09:20:30 EDT 2004


Turns out that the problem was what File.open() returns.  It returns 0 
upon success and my if(localeFile.open('w')) was testing to false.

Sudhakar Chandra wrote:
> I am facing a strange problem.  I am using JSLib version 0.1.185 under 
> Mozilla 1.7.1.  I am having trouble opening a file to write.
> 
> My code looks something like this:

<snip>

> try {
>   dump("Trying to write to " + localPath + "\n");
>   if(localFile.open('w')) {

Here is where the problem was.

>     dump("Writing fetched data to " + localPath + "\n");
>     localFile.write("" + xmlhttp.responseText);
>   } else {
>     dump("Unable to write into " + localPath + "\n");
>   }
> } catch (e) {
>   dump("Error writing fetched data to local file\n");
> }

Thaths
-- 
"Kids, you tried your best and you failed miserably. The lesson is,
                  never try." -- Homer J. Simpson
Slacker Without Borders                        http://openscroll.org/
Key fingerprint = 8A 84 2E 67 10 9A 64 03  24 38 B6 AB 1B 6E 8C E4


More information about the Jslib mailing list