Is An Application

  • Given a path name, this there a way to verify that the path points to
    an application (either Carbon or Cocoa package)?

    I know Cocoa packages will end with the .app suffix but Carbon may not.

    Thanx, SD.
  • Try [NSWorkspace getInfoForFile:application:type:] or if that doesn't work, It might just use the file extension look at LauchServices.

    On Tuesday, November 11, 2003, at 03:19PM, SD <appledevlists...> wrote:

    > Given a path name, this there a way to verify that the path points to
    > an application (either Carbon or Cocoa package)?
    >
    > I know Cocoa packages will end with the .app suffix but Carbon may not.
    >
    > Thanx, SD.
    > _______________________________________________
    > MacOSX-dev mailing list
    > <MacOSX-dev...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev
    >
    >
  • The canonical way is to use LaunchServices (LSInfo.h)

    + (BOOL) isApplicationAtPath:(NSString*)aPath {
        LSItemInfoRecord infoRec;
        LSCopyItemInfoForURL((CFURLRef)[NSURL fileURLWithPath: aPath],
                              kLSRequestBasicFlagsOnly, &infoRec);
        return infoRec.flags & kLSItemInfoIsApplication;
    }

    Karl

    On Nov 10, 2003, at 8:19 PM, SD wrote:

    > Given a path name, this there a way to verify that the path points to
    > an application (either Carbon or Cocoa package)?
    >
    > I know Cocoa packages will end with the .app suffix but Carbon may not.
    >
    > Thanx, SD.
    > _______________________________________________
    > MacOSX-dev mailing list
    > <MacOSX-dev...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev
    >
    >
    --

    It is by caffeine alone that I set my mind in motion.  It is by the
    Coca-Cola that the thoughts acquire speed, the lips acquire stains, the
    stains become a warning.  It is by caffeine alone that I set my mind in
    motion.

    Homepage:
          http://homepage.mac.com/khsu/index.html
previous month november 2003 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
Go to today
MindNode
MindNode offered a free license !