OSXでCocoa/Objective-Cを使用してマウント不可/イジェクト可能なドライブのリストを取得したいと思います。
NSWorkspace getFileSystemInfoForPath :::::が私を助けてくれることを望んでいました:
NSArray* listOfMedia = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths];
NSLog(@"%@", listOfMedia);
for (NSString* volumePath in listOfMedia)
{
BOOL isRemovable = NO;
BOOL isWritable = NO;
BOOL isUnmountable = NO;
NSString* description = [NSString string];
NSString* type = [NSString string];
BOOL result = [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:volumePath
isRemovable:&isRemovable
isWritable:&isWritable
isUnmountable:&isUnmountable
description:&description
type:&type];
NSLog(@"Result:%i Volume: %@, Removable:%i, W:%i, Unmountable:%i, Desc:%@, type:%@", result, volumePath, isRemovable, isWritable, isUnmountable, description, type);
}
出力:
...
Result:1 Volume: /Volumes/LR Photos, Removable:0, W:1, Unmountable:0, Desc:hfs, type:hfs
...
「LRPhotos」は、取り外し可能および/またはマウント解除可能(または少なくともそうあるべきだと思います)の外付けドライブ(Thunderboltを介して接続)です。:)
これについては別の方法で行う必要がありますか?
前もって感謝します!