• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File kind from extension
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File kind from extension


  • Subject: Re: File kind from extension
  • From: "Erik M. Buck" <email@hidden>
  • Date: Fri, 1 Mar 2002 00:49:42 -0600
  • Organization: EMB & Assocites Inc.

See NSString path utilities:

Working with paths
+ pathWithComponents:
- pathComponents
- completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:
- fileSystemRepresentation
- getFileSystemRepresentation:maxLength:
- isAbsolutePath
- lastPathComponent
- pathExtension
- stringByAbbreviatingWithTildeInPath
- stringByAppendingPathComponent:
- stringByAppendingPathExtension:
- stringByDeletingLastPathComponent
- stringByDeletingPathExtension
- stringByExpandingTildeInPath
- stringByResolvingSymlinksInPath
- stringByStandardizingPath
- stringsByAppendingPaths:

You want the -pathExtension method.

See the source code for OpenUp at www.stepwise.com. It already does what
you want.

----- Original Message -----
From: "Sam Goldman" <email@hidden>
To: "Cocoa Dev" <email@hidden>
Sent: Friday, March 01, 2002 12:28 AM
Subject: File kind from extension


> I have recently resumed working on an FTP client after a short sabbatical
> from programming altogether, and I have a few questions.
>
> What is the best way to parse out the extension from a file name. I can
see
> a problem if there is a period in the middle of the name like this
> (some.file.sit) and I start from the first period. If I start at the end
of
> the file name and the file is like this (some.file.tar.gz) I would only
get
> .gz when I want to get .tar as well. I think that I have found something
in
> launch services for this, but is that the *best* way?
>
> I know how to get the proper icon once I have the extension with
> NSWorkspace, but I want to be able to get the kind of file as well. Since
> it's an FTP client, should I just make a .plist of common file extensions,
> or can I get the kind from a built in source? By kind I mean "Stuffit
> Archive" or "Zip Archive," not "image/png"
>
> One reason I can see for making my own table is that it could also include
> data that would determine if it should download in ASCII or BINARY data
> transfer mode.
>
> Thanks,
> Sam
>
> --
> Windows is a 32-bit patch to a 16-bit shell for an 8-bit operating system
> written for a 4-bit processor by a 2-bit company without 1 bit of sense.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: re Hiding controls and another question
  • Next by Date: Re: carbon windows and NSWindow initWithWindowRef:
  • Previous by thread: Re: re Hiding controls and another question
  • Next by thread: Re: File kind from extension
  • Index(es):
    • Date
    • Thread