diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 8145c9076..50e2b6359 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -218,11 +218,11 @@ INT_PTR WINAPI WinProcCallback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP #else void RemovableDriveManager::search_for_drives() { - /* + #if __APPLE__ list_devices(); #endif -*/ + m_current_drives.clear(); m_current_drives.reserve(26); diff --git a/src/slic3r/GUI/RemovableDriveManager.hpp b/src/slic3r/GUI/RemovableDriveManager.hpp index c4f55029b..7109bbd07 100644 --- a/src/slic3r/GUI/RemovableDriveManager.hpp +++ b/src/slic3r/GUI/RemovableDriveManager.hpp @@ -39,7 +39,7 @@ public: void reset_last_save_path(); void print(); private: - RemovableDriveManager():m_drives_count(0),m_last_update(0),m_last_save_path(""){} + RemovableDriveManager():m_drives_count(0),m_last_update(0),m_last_save_path(""),m_rdmmm(nullptr){} void search_for_drives(); void check_and_notify(); std::string get_drive_from_path(const std::string& path);//returns drive path (same as path in DriveData) if exists otherwise empty string "" @@ -54,7 +54,7 @@ private: #elif __APPLE__ void *m_rdmmm; void register_window(); - //void list_devices(); + void list_devices(); void search_path(const std::string &path, const std::string &parent_path); bool compare_filesystem_id(const std::string &path_a, const std::string &path_b); #else diff --git a/src/slic3r/GUI/RemovableDriveManagerMM.h b/src/slic3r/GUI/RemovableDriveManagerMM.h index 8f783c2d2..4a5fa2515 100644 --- a/src/slic3r/GUI/RemovableDriveManagerMM.h +++ b/src/slic3r/GUI/RemovableDriveManagerMM.h @@ -5,5 +5,5 @@ -(instancetype) init; -(void) add_unmount_observer; -(void) on_device_unmount: (NSNotification*) notification; - -@end \ No newline at end of file +-(void) list_dev; +@end diff --git a/src/slic3r/GUI/RemovableDriveManagerMM.mm b/src/slic3r/GUI/RemovableDriveManagerMM.mm index 99abd7386..7e8b56c59 100644 --- a/src/slic3r/GUI/RemovableDriveManagerMM.mm +++ b/src/slic3r/GUI/RemovableDriveManagerMM.mm @@ -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