Checking if folder returns true when using files with package contents

Hi there!

I have this kind of problem that if a file or folder is dropped on my app, the files get processed and if it’s a folder, the folder its contents get processed. I check to see if something dropped is a folder or not with this:

folder of (info for (POSIX file "/path/to/folder"))

It all works fine until you start using files that have package contents like .app or .rtfd and many others.

I can’t check if something is a folder when the last text item of the POSIX path is a “/” because it isn’t in my case. It’s always without a “/” at the end. The same for aliases, files with package contents also end with a “:”.

I could use:

tell application "System Events" to get kind of droppedfiles

But isn’t the result language-dependent ?

Are there workarounds for that? I mean the AppleScript, not the backslash thing. I also can’t use the Finder because it’s slow in my script http://macscripter.net/viewtopic.php?id=20189 (my app is actually AppleScript Studio but the checking for folders belongs in the AppleScript section, doesn’t it.)

Thanks in advance

Hi,

info for has also a package folder property


on open theseItems
	repeat with oneItem in theseItems
		set {package folder:Pa, folder:Fo} to info for oneItem
		if Fo and not Pa then
			-- do things
		end if
	end repeat
end open

Thanks a lot Stefan! I should have checked info for (choose file) before asking…