• 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: Saving an AudioFile without an extension
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving an AudioFile without an extension


  • Subject: Re: Saving an AudioFile without an extension
  • From: kelly jacklin <email@hidden>
  • Date: Mon, 12 Jul 2004 06:04:50 -0700

On Jul 12, 2004, at 3:05 AM, Asher Vander Heiden wrote:

I'm having trouble with using the 'FSMakeFSSpec' to make a 'FSSpec' !

As far as I can tell to use 'FSMakeFSSpec' I will do something like this:

FSSpec fspec;
char* destFilePath = "/Users/lachlanbarratt/Desktop/NewFile";

error = FSMakeFSSpec(0,0,destFilePath,&fspec);

FSMakeFSSpec takes HFS-style paths, not POSIX-style paths. To convert a POSIX-style path into an FSRef, you use:
FSRef ref;
char * destFilePath = "/Users/lachlanbarratt/Desktop/NewFile";
error = FSPathMakeRef((UInt8 *) destFilePath, &ref, NULL);

Always assuming, of course, that the file actually exists (FSRefs can only refer to existing files/directories).

If what you are trying to do is to set the file type and creator on a file (as I gather it is from the surprisingly volatile thread), then you would do something like this (without the need to use the old spec-based APIs someone referenced):
FSCatalogInfo info;
error = FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &info, NULL, NULL, NULL);
if (error == noErr) {
FileInfo * finfop = &info.finderInfo;
finfop->fileType = 'Sd2f';
finfop->fileCreator = 'TVOD'; // or 'Sd2a', or whatever...
error = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &info);
}

If you really did need an FSSpec (there are very few cases where you need an FSSpec nowadays), you can convert the FSRef to an FSSpec:
FSSpec spec;
error = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, &spec, NULL);

Hope this helps...

I cannot explain why Apple have decided to use so many different types of strings ??? I've probably wasted about 2 weeks work just trying to satisfy all of Apples string requirements. This is the first and maybe the last time I work with Apple.

I realize you're frustrated, and probably just venting, but if you're a professional who is serious about software development, I would recommend reading some developer documentation in the future before diving in. It does not take 2 weeks to figure out the APIs, if you spend 20 minutes reading the docs beforehand. There's also a lot of sample code on developer.apple.com. Sorry if these suggestions are obvious, but I'm hoping they will prove helpful.

kelly
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


References: 
 >RE: Saving an AudioFile without an extension (From: "Asher Vander Heiden" <email@hidden>)

  • Prev by Date: Re: Saving an AudioFile without an extension (Modified by Marc Poirier)
  • Next by Date: Re: boot chime volume?
  • Previous by thread: Re: Saving an AudioFile without an extension
  • Next by thread: RE: Saving an AudioFile without an extension
  • Index(es):
    • Date
    • Thread