* Source/NSWorkspace.m: Exclude list of reserved mount names from

the results returned by -mountedLocalVolumePaths.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26852 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-09-17 21:51:50 +00:00
parent 56e1cbc82a
commit d2901739b5
2 changed files with 33 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2008-09-17 17:52-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSWorkspace.m: Exclude list of reserved mount names from
the results returned by -mountedLocalVolumePaths.
2008-09-14 13:18-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* install.sh: Adding install script for use by compile-all.

View file

@ -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]];
}