diff --git a/ChangeLog b/ChangeLog index 296aaf4a9..e8fa5c763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-09-17 17:52-EDT Gregory John Casamento + + * Source/NSWorkspace.m: Exclude list of reserved mount names from + the results returned by -mountedLocalVolumePaths. + 2008-09-14 13:18-EDT Gregory John Casamento * install.sh: Adding install script for use by compile-all. diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 48b936ea4..b6a4fd491 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -1609,6 +1609,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath FILE *fptr = fopen("/etc/mtab", "r"); struct mntent *m; + names = [NSMutableArray arrayWithCapacity: 8]; while ((m = getmntent(fptr)) != 0) { @@ -1619,10 +1620,33 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath [names addObject: path]; } #else + NSString *mtabPath; + NSString *mtab; + NSArray *mounts, *reservedMountNames; - // FIXME This is system specific - NSString *mtab = [NSString stringWithContentsOfFile: @"/etc/mtab"]; - NSArray *mounts = [mtab componentsSeparatedByString: @"\n"]; + // get mount table... + mtabPath = [[NSUserDefaults standardUserDefaults] objectForKey:@"GSMtabPath"]; + if (mtabPath == nil) + { + mtabPath = @"/etc/mtab"; + } + + // get reserved names.... + reservedMountNames = [[NSUserDefaults standardUserDefaults] objectForKey: @"GSReservedMountNames"]; + if(reservedMountNames == nil) + { + reservedMountNames = [NSArray arrayWithObjects: + @"proc",@"devpts", + @"shm",@"usbdevfs", + @"devpts",@"sysfs", + @"tmpfs",@"procbususb", + @"udev",nil]; + [[NSUserDefaults standardUserDefaults] setObject: reservedMountNames + forKey: @"GSReservedMountNames"]; + } + + mtab = [NSString stringWithContentsOfFile:mtabPath]; + mounts = [mtab componentsSeparatedByString: @"\n"]; unsigned int i; names = [NSMutableArray arrayWithCapacity: [mounts count]]; @@ -1638,9 +1662,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath { NSString *type = [parts objectAtIndex: 2]; - if ([type isEqualToString: @"proc"] == NO - && [type isEqualToString: @"devpts"] == NO - && [type isEqualToString: @"shm"] == NO) + if ([reservedMountNames containsObject: type] == NO) { [names addObject: [parts objectAtIndex: 1]]; }