Directory Walker question

David Vaughan dvk at dvkconsult.com.au
Thu Feb 5 00:38:00 EST 2004


/Applications/Revolution 2.1.2/Revolution.app
Creator:
Type:

On 05/02/2004, at 15:36, Barry Levine <themacguy at macosx.com> wrote:
>
> In a number of earlier digests, there was discussion about the  
> "directory walker". I've copied that code into my script and, sure  
> enough, it works exactly as advertised. However, in OSX, it also walks  
> down through app bundles. I'd like to stop before diving into the  
> bundle. However, I need to get the total size of the bundle (both data  
> and resource) for later purposes. I've played with the "detailed  
> files" function and it looks like I may have to use it to add up  
> everything inside the bundle. I don't mind doing that (as Rev is  
> really quite fast).
>
> Near as I can tell, I'd have to use the "detailed files" function  
> after using the directory walker in order to add up the bytes of both  
> forks of all the files, and then run a modified version of the  
> directory walker routine which would permit me to recognize app  
> bundles and end up with a list that's similar to what the user sees in  
> the Finder. (Alternatively, once I have the detailed files of the  
> entire tree, could I parse through it and eliminate what I don't  
> need?)
>
> Here's what the directory walker sees (I've removed the enclosing  
> folders to make it readable in this eMail):
>
> Adobe ImageReady 7.0/Adobe ImageReady 7.0,0,949
> Adobe ImageReady 7.0/Contents/Info.plist,14148,0
> Adobe ImageReady 7.0/Contents/MacOS/ACECarbonLib,526041,518
> Adobe ImageReady 7.0/Contents/MacOS/ADM-PNG,46781,2989
> Adobe ImageReady 7.0/Contents/MacOS/ADMCarbon Plugin,882650,71737
> (and lots more lines listing the stuff inside the ImageReady app)
>
> So the big question is: How do I get the directory walker to recognize  
> that it's encountered an OSX app bundle (ImageReady 7.0, in this case)  
> and have it -not- examine what's inside. In the above example, it's  
> already dropped inside the ImageReady bundle. Using the above example,  
> what I'd like to end up with is simply "Adobe ImageReady 7.0" as the  
> only line.

Barry

I notice that in the "detailed folders" listing, an app bundle appears  
as follows (for example):
Revolution.app,136,1535180800,1035608180,1068205493,1075788371,0,501,80, 
777,????????

Note it is in the folder list, not the file list, has question marks  
for creator/type and a ".app" suffix on the name. I am assuming this  
will provide reliable identification.

When you encounter a folder of this nature, initiate directory walker  
for that folder alone (this is within your normal walk process - you  
will need to add this code), add up the components, and list it under  
the app bundle name with ".app" stripped. OK?

Well, I think it should work :-)

cheers
David

>
> Thanks for any suggestions,
> Barry



More information about the use-livecode mailing list