year, of course you are right. here my latest version, including another
little optimization:
on fileExists myFile
pd = the last char of the moviepath
od = the itemdelimiter
the itemdelimiter = pd
myPath = myFile
myFileName = the last item of myFile
delete the last item of myPath
put pd after myPath
the itemdelimiter = od
i=1
repeat while true
f = getNthFileNameInFolder(myPath, i)
if f = EMPTY then return false
if f = myFileName then return true
i=i+1
end repeat
end
Buzz Kettles wrote:
> very nice solution, however, I'd suggest the changes below so that
> the function can be called from within another routine that might
> already be using the itemDelimiter set to something else.
>
> -Buzz
>
> At 9:08 PM +0200 4/2/04, you wrote:
>> if anyone cares, here my solution for a lingo-based
>> fileExists()-function. I've tried the proposal made my Buzz, but this
>> would mean that I would need 2 instances of fileIO Xtra for every
>> call of fileExists(), which seemed too ugly.
>> now I simply use:
>>
>> on fileExists myFile
>> pd = the last char of the moviepath
>
> oldItemDelim = the itemDelimiter
>
>> the itemdelimiter = pd
>> myPath = myFile
>> delete the last item of myPath
>> put pd after myPath
>>
>> i=0
>> repeat while TRUE
>> i=i+1
>> f = getNthFileNameInFolder(myPath, i)
>> if f = EMPTY then
> the itemDelimiter = oldItemDelim
> return FALSE
> end if
>>
>> if myPath & f = myFile then
> the itemDelimiter = oldItemDelim
> return TRUE
> end if
>> end repeat
>> end
> [To remove yourself from this list, or to change to digest mode, go
> to http://www.penworks.com/lingo-l.cgi To post messages to the list,
> email [EMAIL PROTECTED] (Problems, email
> [EMAIL PROTECTED]). Lingo-L is for learning and helping with
> programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL
PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping
with programming Lingo. Thanks!]