I\'m creating an application on the Mac in Cocoa that plays audio. I think the best place for my application to search for audio files on a user\'s computer is to get the direct
Edit: As others have pointed out, the approach below doesn't address the case that the iTunes library may not be in a user's home folder. See David's answer for a better solution. Finding the user's music folder may still be somewhat useful for finding a standard (though not the only) location of non-iTunes audio files (e.g. as the default folder for an open panel).
Original answer:
You could locate the user's Music folder via
NSString *musicPath = [NSSearchPathForDirectoriesInDomains(NSMusicDirectory, NSUserDomainMask, YES) objectAtIndex:0];
This will normally have an iTunes subdirectory that contains the file "iTunes Music Library.xml" which contains most metadata of the user's iTunes library. Don't try to write to it though - iTunes only creates this file so that other apps can access it, but doesn't use it internally otherwise.