• 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: getting drive/media type (CD/DVD only)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting drive/media type (CD/DVD only)


  • Subject: Re: getting drive/media type (CD/DVD only)
  • From: Simon Bovet <email@hidden>
  • Date: Wed, 22 Jun 2005 14:05:05 +0200

This thread finished by only indicating how to retrieve the icon of a given volume. What if I want to know which volumes are actual CDs or DVDs?

So far, I use statfs and define a CD/DVD (i.e. anything for which the finder would show a disc icon) as a volume for which either:

- buffer.f_bavail == 0
- or buffer.f_mntfromname begins with "/dev/disk1"

Is that a correct/reliable way of detecting CDs or DVDs?

Thanks for any hint!
Simon




Hi Joannou,

actually, I've noticed that f_fstypename was "hfs" for HD or networks and "udf" for a CD. Is this reliable? What would be the type for a firewire drive/iPod, or any other type of device? Is there a list I can consult?

I have to create a window that displays network drives, HD, CD, etc in a table view so I need to know what type of drive it is so I can display the correct icon.

Thanks!


On 12-Apr-05, at 9:22 PM, Joannou Ng wrote:


Hi Luc,

I use the value of f_fstypename in the statfs struct to determine volume format for an app that I wrote that only targeted Xsan volumes.

What specific information are you looking for?

Cheers, Joannou.

On 2005 Apr 12, at 20:22, Luc Vandal wrote:


Hi,

I've been looking for a way to get information about volumes (removable, CD, FW, iPod, HD, etc.). So far I've been using getFileSystemInfoForPath and statfs but unless I'm not using the correctly, I don't really get any information about what I'm looking for.

Here's the code I'm using:

while (file = [enumerator nextObject])
{
NSString* strFile = [NSString stringWithFormat:@"%s%s", "/Volumes/", [file cString]];


[[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:strFile isRemovable:&bIsRemovable isWritable:&bIsWritable isUnmountable:&bIsUnmountable description:&strDesc type:&strType];
[enumerator skipDescendents];


        struct statfs b;

        statfs( [strFile cString], &b );

        NSDictionary* dir = [enumerator directoryAttributes];

    [self addVolume:file icon:@"VOL"];
    }

First, strDesc and strType are always null. Is there anything helpful in the statfs struct that could help me find the information I'm looking for?

Thanks!

Luc _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40tomatocheese.com


This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40arizona-software.ch


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Confused by Apple's DragNDropOutlineView example
  • Next by Date: Re: Confused by Apple's DragNDropOutlineView example
  • Previous by thread: Re: Core Data: Changing Transient Keys Dirties Database?
  • Next by thread: [still having probs] Re: Printing my document
  • Index(es):
    • Date
    • Thread