I'm nearly positive this is an AppKit issue, but I thought I'd bring
it up here as a reference point for other  developers who are left
scratching their heads.

The mountedLocalVolumePaths method in NSWorkspace is a popular way for
Cocoa applications to get a list of all volumes. If a MacFUSE volume
is mounted with the 'local' flag, then mountedLocalVolumePaths does
not include the volume in its results. Obviously, the local flag is a
"use at your own risk" option - but on Leopard it is the only way to
get a MacFUSE volume automatically listed in Finder's sidebar, so we
use it.

If you're using this mountedLocalVolumePaths and want to make sure you
pick up MacFUSE local volumes [such as ExpanDrive volumes], I suggest
augmenting your code in with the additional code I'm providing below.
I'm posting the code here in case others have a better idea or Amit
immediately recognizes this as a terrible solution.

previously:
NSArray *mountedVolumes = [[NSWorkspace sharedWorkspace]
mountedLocalVolumePaths];

new:
#import <sys/mount.h>
...

// using a set to ensure there aren't multiple entries of the same
volume
NSMutableSet *mountedVolsSet = [NSMutableSet setWithArray:
[[NSWorkspace sharedWorkspace] mountedLocalVolumePaths]];

struct statfs *buf = NULL;
unsigned i, count = 0;

count = getmntinfo(&buf, 0);
for (i=0; i<count; i++)
{
    // add in all volumes prefixed with fstypename "fusefs"
    if(strncmp(buf[i].f_fstypename,"fusefs", sizeof("fusefs")) == 0)
        [mountedVolsSet addObject:[NSString stringWithCString:buf
[i].f_mntonname]];
}

// if you feel the need to keep volumes in an NSArray
NSArray *mountedVols = [mountedVolsSet allObjects];

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MacFUSE" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/macfuse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to