Christophe Charron-2 wrote:
> 
> Hi,
> 
> 2007/4/18, salah <[EMAIL PROTECTED]>:
>>
>>
>> Hi everyone , :)
>> I try removing /home/user/file.txt file using code bellow but it doesn't
>> work can any one help me
>>
>> ______________________________________________________________________
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
>> <window
>>     id="findfile-window"
>>    
>> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>
>>     <script>
>>         function delFile() {
>>             var aFile =
>> Components.classes["@mozilla.org/file/local;1"].createInstance();
>>             if ( aFile instanceof Components.interfaces.nsILocalFile) {
>>                 aFile.initWithPath("/home/user/file.txt");
>>                 aFile.remove(false);
>>             }
>>         }
>>     </script>
>>     <button label="Button 1" oncommand="delFile();"/>
>> </window>
> 
> 
> What happens ? Any exception caught ? Are you sure having rigths ? Can you
> open it ?
> 
> 
> ___
> -- 
> Cordially
> Christophe Charron
> 
> 
I modify code to catch exception :
.........................
<script>
        function delFile() {
             try {
            var aFile =
Components.classes["@mozilla.org/file/local;1"].createInstance();
              if ( aFile instanceof Components.interfaces.nsILocalFile ) {
                aFile.initWithPath("/home/user/file.txt");
                aFile.remove(false);
            }
            }catch ( e) { alert (e) ; }
        }
    </script>
.........................
- message obtained is : Permission denied to get property
UnnamedClass.classes
- file.txt 's rights access are :  777 
- I can open file.txt
-- 
View this message in context: 
http://www.nabble.com/How-to-Remove-file---tf3601735.html#a10079647
Sent from the XUL - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
XUL News Wire      - http://xulnews.com
XUL Job Postings   - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org  
_______________________________________________
xul-talk mailing list
xul-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xul-talk

Reply via email to