Programatically identifying bundles and frameworks?

  • Hi all, I am working on an application that is designed to help a user
    clean up their disk space by identifying identical and near-identical
    files (in case they've decided to make backups, and forgot that they
    had).  The only problem I'm running into is handling bundles and
    frameworks; I want to be able to identify that I'm walking into a bundle
    or framework, and treat the entire thing as a single unit.  Is there a
    programmatic way of doing this, something along the lines of +(Bool)
    isBundle:(NSString *) canonicalPathToDirectory;?

    Thanks,
    Cem Karan
  • On Oct 17, 2007, at 3:19 PM, Karan, Cem (Civ, ARL/CISD) wrote:

    > Hi all, I am working on an application that is designed to help a user
    > clean up their disk space by identifying identical and near-identical
    > files (in case they've decided to make backups, and forgot that they
    > had).  The only problem I'm running into is handling bundles and
    > frameworks; I want to be able to identify that I'm walking into a
    > bundle
    > or framework, and treat the entire thing as a single unit.  Is there a
    > programmatic way of doing this, something along the lines of +(Bool)
    > isBundle:(NSString *) canonicalPathToDirectory;?

    Check out NSWorkspace's isFilePackageAtPath:

    ___________________________________________________________
    Ricky A. Sharp        mailto:<rsharp...>
    Instant Interactive(tm)  http://www.instantinteractive.com
  • On Oct 17, 2007, at 1:19 PM, Karan, Cem (Civ, ARL/CISD) wrote:

    > Hi all, I am working on an application that is designed to help a user
    > clean up their disk space by identifying identical and near-identical
    > files (in case they've decided to make backups, and forgot that they
    > had).  The only problem I'm running into is handling bundles and
    > frameworks; I want to be able to identify that I'm walking into a
    > bundle
    > or framework, and treat the entire thing as a single unit.  Is there a
    > programmatic way of doing this, something along the lines of +(Bool)
    > isBundle:(NSString *) canonicalPathToDirectory;?

    No, there is not.  Any directory on the file system can be treated as
    a bundle for purposes of CFBundle/NSBundle resource lookup.  There is
    a related notion, that of a "package", which is a directory that is
    presented to the user as a single opaque item; you can use Launch
    Services or NSWorkspace to identify those.  However, frameworks
    generally are not packages--they are transparent to the user, and
    developers (for example) can use this to look at their headers.
    However, it is usually fairly simple to identify frameworks on the
    system.

    Douglas Davidson
  • On 10/17/07, Karan, Cem (Civ, ARL/CISD) <CKaran...> wrote:
    > Hi all, I am working on an application that is designed to help a user
    > clean up their disk space by identifying identical and near-identical
    > files (in case they've decided to make backups, and forgot that they
    > had).  The only problem I'm running into is handling bundles and
    > frameworks; I want to be able to identify that I'm walking into a bundle
    > or framework, and treat the entire thing as a single unit.  Is there a
    > programmatic way of doing this, something along the lines of +(Bool)
    > isBundle:(NSString *) canonicalPathToDirectory;?

    In the case of frameworks, have you considered checking for the
    ".framework" extension? :-) I know it's incredibly simplistic, but
    ......

    --
    I.S.
  • OK, that looks like a good start.  Douglas Davidson pointed out that
    anything on the system can be a bundle, which is what I was worried
    about, and I. Savant pointed out that I could look for extensions of
    names (something that I am doing, but feels like a real hack), but since
    this is what I've got, its what I'll go with.

    Hmmmm... I guess I should write up a bug report + use case for this, but
    before I bog down the Apple engineers with a request for something that
    only I may end up using, are there any others that need the ability to
    identify if a directory is actually a bundle/framework/package/some
    other 'atomic' object?

    Thanks!
    Cem Karan

    -----Original Message-----
    From: Ricky Sharp [mailto:<rsharp...>]
    Sent: Wednesday, October 17, 2007 4:22 PM
    To: Karan, Cem (Civ, ARL/CISD)
    Cc: <cocoa-dev...>
    Subject: Re: Programatically identifying bundles and frameworks?

    On Oct 17, 2007, at 3:19 PM, Karan, Cem (Civ, ARL/CISD) wrote:

    > Hi all, I am working on an application that is designed to help a user

    > clean up their disk space by identifying identical and near-identical
    > files (in case they've decided to make backups, and forgot that they
    > had).  The only problem I'm running into is handling bundles and
    > frameworks; I want to be able to identify that I'm walking into a
    > bundle or framework, and treat the entire thing as a single unit.  Is
    > there a programmatic way of doing this, something along the lines of
    > +(Bool) isBundle:(NSString *) canonicalPathToDirectory;?

    Check out NSWorkspace's isFilePackageAtPath:

    ___________________________________________________________
    Ricky A. Sharp        mailto:<rsharp...>
    Instant Interactive(tm)  http://www.instantinteractive.com
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today