Re: Finding user's Music folder (and others)?

2009-09-18 Thread Jens Alfke


On Sep 17, 2009, at 9:32 PM, Graham Cox wrote:

It's also pretty common to relocate it - don't assume it's unusual.  
Quite a few people like to keep their music on an external drive so  
whatever it is you're doing, if you assume ~/Music/, it'll fail in  
those cases, as you realise.


Yes! I've sent bug reports to so many developers of iTunes utilities  
that hardcode this :P


Probably better to work out how to obtain iTunes setting - maybe by  
peeking at its prefs.


Just use NSUserDefaults:

$ defaults read com.apple.iApps
{
iTunesRecentDatabasePaths = (
/Users/Shared/snej/Music/iTunes/iTunes Music Library.xml
);
iTunesRecentDatabases = (
file://localhost/Users/Shared/snej/Music/iTunes/iTunes%20Music%20Library.xml 


);
}

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Finding user's Music folder (and others)?

2009-09-17 Thread Rick Mann
I need to find the iTunes Music Library.xml file, which I know to be  
in the iTunes music folder under the iTunes directory. Is there an API  
call to get the user's Music folder? I realize iTunes allows you to  
specify another location for the music folder, so perhaps I need to  
ask iTunes for it directly, but for the time being finding the Music  
folder is a good start.


Generally speaking, how do I find the special user directories?

I know about NSHomeDirectory(). Searching Google and the docs for  
things like find folder special directories fsfindfolder turned  
up a ton of pretty useless stuff.



TIA,
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: SOLVED Finding user's Music folder (and others)?

2009-09-17 Thread Rick Mann
Sigh, sorry. I looked at NSSearchPathForDirectoriesInDomains() and  
dismissed it without looking more closely. That's what I needed.


Sorry for the noise.

On Sep 17, 2009, at 18:52:28, Rick Mann wrote:

I need to find the iTunes Music Library.xml file, which I know to  
be in the iTunes music folder under the iTunes directory. Is there  
an API call to get the user's Music folder? I realize iTunes allows  
you to specify another location for the music folder, so perhaps I  
need to ask iTunes for it directly, but for the time being finding  
the Music folder is a good start.


Generally speaking, how do I find the special user directories?

I know about NSHomeDirectory(). Searching Google and the docs for  
things like find folder special directories fsfindfolder  
turned up a ton of pretty useless stuff.



TIA,
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com

This email sent to rm...@latencyzero.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Rick Mann
Hmm. I take it back. I can't get code calling  
NSSearchPathForDirectoriesInDomains() to compile.


   NSArray* paths = NSSearchPathForDirectoriesInDomains 
(NSMusicDirectory, NSUserDomainMask, false);


error: 'NSMusicDirectory' was not declared in this scope

What do I need to do to get NSMusicDirectory?

TIA.

On Sep 17, 2009, at 19:03:47, Rick Mann wrote:

Sigh, sorry. I looked at NSSearchPathForDirectoriesInDomains() and  
dismissed it without looking more closely. That's what I needed.


Sorry for the noise.

On Sep 17, 2009, at 18:52:28, Rick Mann wrote:

I need to find the iTunes Music Library.xml file, which I know to  
be in the iTunes music folder under the iTunes directory. Is there  
an API call to get the user's Music folder? I realize iTunes allows  
you to specify another location for the music folder, so perhaps I  
need to ask iTunes for it directly, but for the time being finding  
the Music folder is a good start.


Generally speaking, how do I find the special user directories?

I know about NSHomeDirectory(). Searching Google and the docs for  
things like find folder special directories fsfindfolder  
turned up a ton of pretty useless stuff.



TIA,
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com

This email sent to rm...@latencyzero.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com

This email sent to rm...@latencyzero.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Michael Babin

On Sep 17, 2009, at 10:03 PM, Rick Mann wrote:

Hmm. I take it back. I can't get code calling  
NSSearchPathForDirectoriesInDomains() to compile.


  NSArray* paths = NSSearchPathForDirectoriesInDomains 
(NSMusicDirectory, NSUserDomainMask, false);


error: 'NSMusicDirectory' was not declared in this scope

What do I need to do to get NSMusicDirectory?


Are you building with the 10.6 SDK? NSMusicDirectory is available in  
10.6 and later, according to the docs and the header file  
(NSPathUtilities.h).

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Rick Mann


On Sep 17, 2009, at 20:15:43, Michael Babin wrote:


On Sep 17, 2009, at 10:03 PM, Rick Mann wrote:

Hmm. I take it back. I can't get code calling  
NSSearchPathForDirectoriesInDomains() to compile.


  NSArray* paths = NSSearchPathForDirectoriesInDomains 
(NSMusicDirectory, NSUserDomainMask, false);


error: 'NSMusicDirectory' was not declared in this scope

What do I need to do to get NSMusicDirectory?


Are you building with the 10.6 SDK? NSMusicDirectory is available in  
10.6 and later, according to the docs and the header file  
(NSPathUtilities.h).


Well, I thought I had, but I tried again just to be sure. That's the  
trick. I just overlooked the line that said 10.6. Thanks!


--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Steve Christensen

On Sep 17, 2009, at 8:18 PM, Rick Mann wrote:


On Sep 17, 2009, at 20:15:43, Michael Babin wrote:


On Sep 17, 2009, at 10:03 PM, Rick Mann wrote:

Hmm. I take it back. I can't get code calling  
NSSearchPathForDirectoriesInDomains() to compile.


  NSArray* paths = NSSearchPathForDirectoriesInDomains 
(NSMusicDirectory, NSUserDomainMask, false);


error: 'NSMusicDirectory' was not declared in this scope

What do I need to do to get NSMusicDirectory?


Are you building with the 10.6 SDK? NSMusicDirectory is available  
in 10.6 and later, according to the docs and the header file  
(NSPathUtilities.h).


Well, I thought I had, but I tried again just to be sure. That's  
the trick. I just overlooked the line that said 10.6. Thanks!


And if you want to get that path for earlier OS versions, you could  
use FSFindFolder:



NSString* musicFolderPath = nil;
FSRef musicFolderRef;

if (FSFindFolder(kUserDomain, kMusicDocumentsFolderType,  
kCreateFolder, musicFolderRef) == noErr)

{
NSURL* musicFolderURL = [(NSURL*)CFURLCreateFromFSRef(NULL,  
musicFolderRef) autorelease];


musicFolderPath = [musicFolderURL path];
}

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Graham Cox


On 18/09/2009, at 11:52 AM, Rick Mann wrote:

I realize iTunes allows you to specify another location for the  
music folder, so perhaps I need to ask iTunes for it directly, but  
for the time being finding the Music folder is a good start.



It's also pretty common to relocate it - don't assume it's unusual.  
Quite a few people like to keep their music on an external drive so  
whatever it is you're doing, if you assume ~/Music/, it'll fail in  
those cases, as you realise. Probably better to work out how to obtain  
iTunes setting - maybe by peeking at its prefs.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finding user's Music folder (and others)?

2009-09-17 Thread Rick Mann
For sure, and we will be. I suspect one can ask iTunes via an  
AppleEvent, but looking at the prefs is not a bad suggestion. I just  
needed a reasonable solution that was easy to get to in the meantime.


Thanks.

On Sep 17, 2009, at 21:32:00, Graham Cox wrote:



On 18/09/2009, at 11:52 AM, Rick Mann wrote:

I realize iTunes allows you to specify another location for the  
music folder, so perhaps I need to ask iTunes for it directly, but  
for the time being finding the Music folder is a good start.



It's also pretty common to relocate it - don't assume it's unusual.  
Quite a few people like to keep their music on an external drive so  
whatever it is you're doing, if you assume ~/Music/, it'll fail in  
those cases, as you realise. Probably better to work out how to  
obtain iTunes setting - maybe by peeking at its prefs.


--Graham




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com