mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 02:37:51 -06:00
macos list devices
This commit is contained in:
parent
40a83e67dd
commit
3b6daf64c7
4 changed files with 42 additions and 35 deletions
|
@ -25,6 +25,36 @@
|
|||
NSLog(@"add unmount observer");
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector: @selector(on_device_unmount:) name:NSWorkspaceDidUnmountNotification object:nil];
|
||||
}
|
||||
-(void) list_dev
|
||||
{
|
||||
NSLog(@"---");
|
||||
NSArray* devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
|
||||
for (NSString* volumePath in devices)
|
||||
{
|
||||
NSLog(@"@", volumePath);
|
||||
}
|
||||
NSLog(@"--");
|
||||
//removable here means CD not USB :/
|
||||
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);
|
||||
}
|
||||
}
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
void RemovableDriveManager::register_window()
|
||||
|
@ -32,39 +62,16 @@ void RemovableDriveManager::register_window()
|
|||
m_rdmmm = nullptr;
|
||||
m_rdmmm = [[RemovableDriveManagerMM alloc] init];
|
||||
}
|
||||
void RemovableDriveManager::list_devices()
|
||||
{
|
||||
if(m_rdmmm == nullptr)
|
||||
return;
|
||||
[m_rdmmm list_dev];
|
||||
}
|
||||
}}//namespace Slicer::GUI
|
||||
|
||||
/*
|
||||
-(void) RemovableDriveManager::list_devices()
|
||||
{
|
||||
NSLog(@"---");
|
||||
NSArray* devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
|
||||
for (NSString* volumePath in listOfMedia)
|
||||
{
|
||||
NSLog(@"@", volumePath);
|
||||
}
|
||||
NSLog(@"--");
|
||||
//removable here means CD not USB :/
|
||||
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);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue