Re: File v. Folder
Re: File v. Folder
- Subject: Re: File v. Folder
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 26 Feb 2001 08:45:17 -0800
On 2/26/01 7:21 AM, "Phil Burk" <email@hidden> wrote:
>
I know that I can refer to an object via its path as alias ("DMG:Documents:"
>
for a folder, "DMG:Document:some doc.pdf" as a file).
>
>
What other ways are there to refer to an object and determine whether it is
>
a file or a folder other than its path? Is there a <<sys event>> I can use?
>
What about some properties of info for?
As a sort of hack, you could
try
set ft to file type of (info for someAlias)
set ff to "It's a file!"
on error number errNum
if errNum = -1728 then -- can't get file type
set ff to "It must be a folder!"
end if
end try
since you can't get the file type of a folder. Someone will probably come up
with some instance where this goes wrong (some inaccessible file type?).
But there are 3rd-party osaxen which are precise:
Akua Sweets osax:
as part of the result for its 'basic info for ' [any alias]:
kind nothing/a folder/a file/an alias [r/o] -- The kind of object
or specifically for an item of a parent folder:
the kind of entry in : Check for existence of a file or folder,
optionally creating a folder.
the kind of entry in alias -- Parent folder alias
named string -- Name of object to check for
[creation boolean] -- Set this to TRUE to have a folder created if
no object exists with this name.
Result : nothing/a folder/a file/an alias -- Kind of object found (or
created if specified)
--
Paul Berkowitz