mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 09:31:00 +00:00
Add missing implementation, by mounting exclusively the path specified in GSRemovableMediaPaths
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39378 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d416ef9ab7
commit
3ddbd0ab4b
2 changed files with 49 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-02-16 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (mountNewRemovableMedia)
|
||||
Add missing implementation, by mounting exclusively the path specified in GSRemovableMediaPaths.
|
||||
|
||||
2016-02-16 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSWorkspace.m (mountedLocalVolumePaths)
|
||||
|
|
|
@ -1897,8 +1897,50 @@ launchIdentifiers: (NSArray **)identifiers
|
|||
|
||||
- (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
|
||||
|
|
Loading…
Reference in a new issue