shiva wrote:
> i am a newbee and downloaded the MOZILLA to develop applications using 
> XPCONNECT as i wanted my XUL program to access some of my native code. 
> My problem is i tried to start from a example given in the XULPLANET.com 
> that accesses the nsILocalFile interface but i couldnt sometime it gives 
> me the error that the component is not defined and sometimes that 
> permission to access component is debied. can u help me out

The file needs to reside in the chrome registry or if it is a local file 
you need to gain access using the universal xpconnect privdledge.

Search in the security for the exact js syntax.


--pete




> 
> i am attaching the program which has a simple find button on clicking 
> which it deletes a file
> 
> Findfiles.xul:
> 
> <?xml version="1.0"?>
> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
> 
> <window
>     id="findfile-window"
>     title="Find Files"
>     orient="vertical"
> xmlns:html="http://www.w3.org/1999/xhtml";
> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>
> <script src="findfiles.js"/>
> <button id="find-button" label="Find" default="true"
>    style="width: 8ex" onclick ="getit();"/>
> </window>
> 
> 
> findfiles.js:
> function getit()
> {
> var aFile = 
> Components.classes["@mozilla.org/file/local;1"].createInstance();
> var aLocalFile = aFile.QueryInterface(Components.interfaces.nsILocalFile);
> if (!aLocalFile) return false;
> aLocalFile.initWithPath("read.txt");
> aLocalFile.delete(false);
> }
> 
> Observation::
> 
> as seen on the task\tools\javascript consile inthe menu for Netscape 6
> 
> 1. if the javascript code is till the first line (i.e the alert 
> statement it works fine)
> 
> 2. if i add 3 more lines (i.e. till LocalFile.initWithPath("read.txt");)
> it gives me a error that permission denied to access property
> 
> 3. if i add the delete function i dont get the alert message and it 
> gives me a msg that get it is not defined and that missing name after 
> operator .
> 
> pls help me out....as to whether i need to set some plug ins or get a 
> licence or build the mozilla...
> 



Reply via email to