@@ -98,7 +98,7 @@ - (instancetype)initWithNSRect: (NSRect)nsRect
9898
9999- (void )resetProgress {
100100 [self setCurrentProgressWithWrittenBytes: 0
101- fileSizeBytes: 0 ];
101+ fileSizeBytes: 0 ];
102102
103103 [currentOperationProgressBarView resetProgressSynchronously ];
104104 [totalOperationProgressBarView resetProgressSynchronously ];
@@ -527,10 +527,9 @@ - (void)writeAction {
527527 [self setIsScheduledForStop: NO ];
528528 [self setEnabledUIState: NO ];
529529
530- NSString *bsdName = [(IdentifiableMenuItem *)devicePickerView.selectedItem userIdentifiableData ];
531- DiskManager *destinationDiskDM = [[DiskManager alloc ] initWithBSDName: bsdName ];
530+ DiskInfo *destinationDiskInfo = [(IdentifiableMenuItem *)devicePickerView.selectedItem diskInfo ];
531+ DiskManager *destinationDiskDM = [[DiskManager alloc ] initWithBSDName: destinationDiskInfo.BSDName ];
532532
533- struct DiskInfo destinationDiskInfo = [destinationDiskDM getDiskInfo ];
534533 if (destinationDiskDM == NULL || !destinationDiskInfo.isDeviceUnit ) {
535534 [self displayWarningAlertWithTitle: BSD_DEVICE_IS_NO_LONGER_AVAILABLE_TITLE
536535 subtitle: PRESS_UPDATE_BUTTON_SUBTITLE
@@ -584,7 +583,7 @@ - (void)writeAction {
584583 logType: ASLogTypeLog];
585584
586585 NSString *diskEraseOperationText = [NSString stringWithFormat: @" Device %@ (%@ %@ ) is ready to be erased with the following properties: (partition_name: \" %@ \" , partition_scheme: \" %@ \" , filesystem: \" %@ \" , patch_security_checks: \" %d \" )." ,
587- bsdName ,
586+ destinationDiskInfo.BSDName ,
588587 destinationDiskInfo.deviceVendor,
589588 destinationDiskInfo.deviceModel,
590589 newPartitionName,
@@ -605,13 +604,13 @@ - (void)writeAction {
605604 filesystem: selectedFileSystem
606605 newName: newPartitionName
607606 error: &diskEraseError];
608-
607+
609608 if (diskEraseError != NULL ) {
610609 [self displayWarningAlertWithTitle: DISK_ERASE_FAILURE_TITLE
611610 subtitle: diskEraseError.stringValue
612611 icon: NSImageNameCaution ];
613612
614- [self ->logsAutoScrollTextView appendTimestampedLine: DISK_ERASE_FAILURE_TITLE
613+ [self ->logsAutoScrollTextView appendTimestampedLine: [ DISK_ERASE_FAILURE_TITLE stringByAppendingFormat: @" (Error message: %@ ) " , diskEraseError.stringValue]
615614 logType: ASLogTypeFatal];
616615
617616 WriteExitForce ();
@@ -644,7 +643,7 @@ - (void)writeAction {
644643 skipSecurityChecks: skipSecurityChecks];
645644
646645 NSError *writeError = NULL ;
647-
646+
648647 [diskWriter startWritingWithError: &writeError
649648 progressCallback: ^DWAction (DWFile * _Nonnull dwFile, uint64 copiedBytes, DWOperationType operationType, DWOperationResult operationResult, NSError * _Nonnull error) {
650649 if (self.isScheduledForStop ) {
@@ -660,7 +659,7 @@ - (void)writeAction {
660659
661660 [self setCurrentProgressWithWrittenBytes: copiedBytes
662661 fileSizeBytes: dwFile.size];
663-
662+
664663 NSString *destinationCurrentFilePath = [targetPartitionPath stringByAppendingPathComponent: dwFile.sourcePath];
665664 NSMutableString *onscreenLogText = [NSMutableString string ];
666665
@@ -796,24 +795,21 @@ - (void)updateDeviceList {
796795
797796 [logsAutoScrollTextView appendTimestampedLine: @" Clearing the device picker list." logType: ASLogTypeLog];
798797
799- NSArray <NSString *> *bsdNames = [DiskManager getBSDDrivesNames ];
798+ NSArray <NSString *> *bsdNames = [DiskManager BSDDrivesNames ];
800799
801800 NSString *textLog = [NSString stringWithFormat: @" Found devices: %@ " , [bsdNames componentsJoinedByString: @" , " ]];
802801 [logsAutoScrollTextView appendTimestampedLine: textLog logType: ASLogTypeLog];
803802
804803 for (NSString *bsdName in bsdNames) {
805804 DiskManager *diskManager = [[DiskManager alloc ] initWithBSDName: bsdName];
806- struct DiskInfo diskInfo = [diskManager getDiskInfo ];
805+ DiskInfo * diskInfo = [diskManager diskInfo ];
807806
808807 if (diskInfo.isNetworkVolume || diskInfo.isInternal ||
809808 !diskInfo.isDeviceUnit || !diskInfo.isWholeDrive || !diskInfo.isWritable ) {
810809 continue ;
811810 }
812811
813- IdentifiableMenuItem *identifiableMenuItem = [[IdentifiableMenuItem alloc ] initWithDeviceVendor: [diskInfo.deviceVendor strip ]
814- deviceModel: [diskInfo.deviceModel strip ]
815- storageCapacityInBytes: [diskInfo.mediaSize floatValue ]
816- bsdName: bsdName];
812+ IdentifiableMenuItem *identifiableMenuItem = [[IdentifiableMenuItem alloc ] initWithDiskInfo: diskInfo];
817813
818814 [devicePickerView.menu addItem: identifiableMenuItem];
819815 }
@@ -830,12 +826,12 @@ - (void)setEnabledUIState:(BOOL)enabledUIState {
830826 if (enabledUIState) {
831827 [self resetProgress ];
832828 [self ->currentOperationLabelView setStringValue: @" Ready for action" ];
833-
829+
834830 [self ->quitMenuItem setAction: @selector (terminate: )];
835831
836832 [self ->bytesWrittenLabelView setStringValue: @" " ];
837833 [self ->bytesFileSizeLabelView setStringValue: @" " ];
838-
834+
839835 [self ->startStopButtonView setTitle: BUTTON_START_TITLE];
840836 [self ->startStopButtonView setAction: @selector (startAction )];
841837 } else {
0 commit comments