realbasic-nug
[Top] [All Lists]

Re: 101 error when deleting a file

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: 101 error when deleting a file
From: Arnaud Nicolet <anic297 at mac dot com>
Date: Mon, 28 Apr 2008 23:14:17 +0200
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <5EB05FDE-421A-41F0-BB4C-7431082362E5 at frontiernet dot net> <8DAA9DD7-D0AA-45E6-9FA1-E8BD2C3B6D5A at mac dot com>
Le 28 avr. 08 à 23:07 (soir), Arnaud Nicolet a écrit:

> Le 28 avr. 08 à 22:34 (soir), Harrie Westphal a écrit:
>
>> Is there a logical reason why REALbasic sets FolderItem.LastErrorCode
>> to 101 when you delete a file? Watching the events in the debugger
>> you can see that the file exists, has been read in and it shows the
>> f.exists=true, f.LastErrorCode=0. Now when f.delete is executed
>> f.exists goes to false, which I would expect, but f.LastErrorCode
>> goes to 101, which seems odd. Yes, the file no longer exists which is
>> what 101 is telling you, but it existed at the point in time when the
>> f.delete was executed so why throw a 101 error at that time? I guess
>> you could argue that that is verification that the file was deleted,
>> but f.exists going to false would also tell you that. Just seems odd
>> to me.
>
> I've tracked this strange behaviour: if you check in the debugger,
> "LastErrorCode" is indeed 101 but if you put MsgBox str
> (f.LastErrorCode), you get "0" which apparently means that this is a
> mistake in the debugger (like because RB is refreshing the properties
> of the folderitem, or something like that).

I've tracked a further weird behaviour with this code:

   dim f As FolderItem

   f=GetOpenFolderItem("Any")
   if f<>nil then
     f.Delete
     MsgBox str(f.LastErrorCode)
     Break
     MsgBox str(f.LastErrorCode)
   end if

First, execute this code without looking at the properties of  
"f" (you resume execution directly at the "break" statement).
You get 2 messages saying "0" (no error).

Second, execute this code with looking at the properties of "f", in  
the debugger, when the break statement is reached (look at the  
"LastErrorCode" property, which says "101").
You get a message saying "0" and another message saying... "2"... not  
"0" or "101" (but perhaps 1+0+1?)

Weird and interesting...
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>