[Jslib] 3253927937 for file functions

Pete Collins pete at mozdevgroup.com
Wed Dec 29 09:39:04 EST 2004



Neil Fraser wrote:

> Whenever I attempt to create a file, jslib returns -3253927937.
>
> <script type="application/x-javascript" 
> src="chrome://jslib/content/jslib.js"></script>
> <script type="application/x-javascript">
>   include (jslib_file);
>   var f = new File("fubar.dat");
>   alert(f.create());
> </script>
>
> This is using Firefox 1.0, jsLib 0.1.242, Windows 98, called from 
> chrome://myproject/content/index.html
>
> There are no JavaScript errors, but no file is created.  I've tried 
> "fubar.dat", "//fubar.dat", "\fubar.dat" all with no result. 
> "alert(f.help)" returns a nice long list of function names, so most of 
> the system is working fine.  Any help would be appreciated.
>
There have been some recent changes that will make using jsLib easier. 
You no longer need to use the extra tag:

  <script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js"></script>

You can do this instead:

<script type="application/x-javascript">

  jslib.init(this);
  include (jslib_file);
  var f = new File("c:\\tmp\\fubar.dat");
  f.create();
  alert(f.exists());

</script>

Also for extra help just type

  jslib:docs

into your browser location bar.

For a list of jslib protocol shortcut commands type jslib:help

Also, there is a sample that does exactly what you are trying to do, 
just type:

  jslib:samples.file

Some other things to note.

  jslib:debug.on
  jslib:debug.off

Turns dump output on or off to see debug info in your shell console. (I 
had problems getting dump to work on windows in non debug builds).

These are some of the recent improvements to jsLib to help make getting 
started w/ the library a bit easier. Look for more in the future.

--pete

-- 
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions 




More information about the Jslib mailing list