Author: rmottola Date: Tue Feb 16 18:23:45 2016 New Revision: 39378 URL: http://svn.gna.org/viewcvs/gnustep?rev=39378&view=rev Log: Add missing implementation, by mounting exclusively the path specified in GSRemovableMediaPaths
Modified: libs/gui/trunk/ChangeLog libs/gui/trunk/Source/NSWorkspace.m Modified: libs/gui/trunk/ChangeLog URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=39378&r1=39377&r2=39378&view=diff ============================================================================== --- libs/gui/trunk/ChangeLog (original) +++ libs/gui/trunk/ChangeLog Tue Feb 16 18:23:45 2016 @@ -1,3 +1,8 @@ +2016-02-16 Riccardo Mottola <r...@gnu.org> + + * Source/NSWorkspace.m (mountNewRemovableMedia) + Add missing implementation, by mounting exclusively the path specified in GSRemovableMediaPaths. + 2016-02-16 Riccardo Mottola <r...@gnu.org> * Source/NSWorkspace.m (mountedLocalVolumePaths) Modified: libs/gui/trunk/Source/NSWorkspace.m URL: http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSWorkspace.m?rev=39378&r1=39377&r2=39378&view=diff ============================================================================== --- libs/gui/trunk/Source/NSWorkspace.m (original) +++ libs/gui/trunk/Source/NSWorkspace.m Tue Feb 16 18:23:45 2016 @@ -1897,8 +1897,50 @@ - (NSArray*) mountNewRemovableMedia { - // FIXME - return nil; + NSArray *removables; + NSArray *mountedMedia = [self mountedRemovableMedia]; + NSMutableArray *willMountMedia = [NSMutableArray array]; + NSMutableArray *newlyMountedMedia = [NSMutableArray array]; + NSUInteger i; + + /* we use the system preferences to know which ones to mount */ + removables = [[[NSUserDefaults standardUserDefaults] persistentDomainForName: NSGlobalDomain] objectForKey: @"GSRemovableMediaPaths"]; + + for (i = 0; i < [removables count]; i++) + { + NSString *removable = [removables objectAtIndex: i]; + + if ([mountedMedia containsObject: removable] == NO) + { + [willMountMedia addObject: removable]; + } + } + + for (i = 0; i < [willMountMedia count]; i++) + { + NSString *media = [willMountMedia objectAtIndex: i]; + NSTask *task = [NSTask launchedTaskWithLaunchPath: @"mount" + arguments: [NSArray arrayWithObject: media]]; + + if (task) + { + [task waitUntilExit]; + + if ([task terminationStatus] == 0) + { + NSDictionary *userinfo = [NSDictionary dictionaryWithObject: media + forKey: @"NSDevicePath"]; + + [[self notificationCenter] postNotificationName: NSWorkspaceDidMountNotification + object: self + userInfo: userinfo]; + + [newlyMountedMedia addObject: media]; + } + } + } + + return newlyMountedMedia; } - (NSArray*) mountedRemovableMedia _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs