Re: How can i do?... ("exists" handler)
Re: How can i do?... ("exists" handler)
- Subject: Re: How can i do?... ("exists" handler)
- From: Richard Morton <email@hidden>
- Date: Mon, 7 Jan 2002 10:39:27 +1100
On Saturday, January 5, 2002, at 10:13 AM, Daniel A.Shockley wrote:
How can i ask Finder if exist a file in a directory ??
Here's a really fast "exists" handler that doesn't bother with the
Finder...
[...]
-- gets somewhat slower as nested-depth level goes over 10
nested folders
I find that lots of file commands do the same - it's noticeable on 'info
for' as well - though it seems to be incremental.
try
inputPath as alias
return true
on error
return false
end try
end testPathExists
One potential issue with this is that it will erroneously return true if
an empty string is passed. At least under classic MacOS. You may never
pass bad data, but I must say I have on occasion. :-} This has been
adjusted to deal with that.
on theItemExists against pathString
if pathString is not equal to "" then try
get alias pathString
return true
end try
return false
end theItemExists
Cheers,
Richard Morton
-- wondering if there will ever be a version of X that doesn't make the
G4 feel like a Quadra...