• 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: How to check if a drive is an iPod
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check if a drive is an iPod


  • Subject: Re: How to check if a drive is an iPod
  • From: Gus Mueller <email@hidden>
  • Date: Wed, 16 Jul 2003 07:36:04 -0700

email@hidden (email@hidden) wrote:
> Is there a simple way to detect whether a drive is an iPod or not?
> I'm guessing there's some file on it that you can check but I'm just
> not sure how to do it. Any ideas?

I look for a folder called "iPod_Control"-
Here's a method I use in my code, pardone the reformatting my my email
client:

- (NSString*) getIPod {

NSArray *allVolumes = [[NSWorkspace sharedWorkspace]
mountedRemovableMedia];
NSMutableArray *iPodVolumes = [NSMutableArray array];
unsigned i;

for (i=0;i<[allVolumes count];i++) {

NSString *iPodControlPath = [[allVolumes objectAtIndex:i]
stringByAppendingPathComponent:@"iPod_Control"];

if ([[NSFileManager defaultManager]
fileExistsAtPath:iPodControlPath]) {
NSString *volumeName = [[allVolumes objectAtIndex:i]
lastPathComponent];
[iPodVolumes addObject:[allVolumes objectAtIndex:i]];
NSLog(@"Got an iPod volume named %@", volumeName);
}
}

if ([iPodVolumes count] == 0) {
NSRunAlertPanel(@"No iPod found.", @"Sorry, but I couldn't find
a connected iPod.", @"OK", nil, nil);
return nil;
}
else if ([iPodVolumes count] > 1) {
NSString *selected = [[iPodVolumes
objectAtIndex:0]substringFromIndex:9];
NSRunAlertPanel(@"You've got more than one iPod!", [NSString
stringWithFormat:@"You lucky dog. Well, for now I'm just going to use
the one named \"%@\".", selected], @"OK", nil, nil);
}

return [iPodVolumes objectAtIndex:0];
}


-gus

--
Flying Meat Software http://flyingmeat.com/
"Christmas means carnage!" -- Ferdinand, the duck
_______________________________________________
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.

References: 
 >How to check if a drive is an iPod (From: email@hidden)

  • Prev by Date: Re: -mdynamic-no-pic
  • Next by Date: Re: Power Builder doesn't launch
  • Previous by thread: How to check if a drive is an iPod
  • Next by thread: Menu item validation problem
  • Index(es):
    • Date
    • Thread