There's the *tiny* downside of hardcoding the string "fusefs" in your
programs/file systems. I wouldn't assume that the file system type
name, or for that matter even the product name, are constant forever.
It's not a big deal though--just something to keep in mind.

Interestingly enough, the problem you are seeing is in fact related to
similar hardcoding. We've seen in previous discussions that many OS X
components use hardcoded strings--rather than Apple's own APIs--to
check for file-system related things.

In your case, if you mount a MacFUSE volume normally (no "-o local",
which is the default), as you already know, it *will* show up in the
list returned by mountedLocalVolumePaths. This is incorrect because
the volume isn't tagged as local.

As you point out, adding "-o local" stops it from being listed. This
is also incorrect, because now the volume *is* tagged local. (By the
way, have you filed radars with Apple for the local bit not being
treated properly by the Finder sidebar, and then this issue, etc.? You
really, really should. All MacFUSE developers should--for every single
issue that you guys come across. This is what Apple recommends too
because this is the only way they assess the priority of bugs to fix.)

Try this: while keeping "-o local", also add "-o fsname=ExpanDrive/
sftp" (or "ExpanDrive/ftp" etc.). I think the fsname you use has to
have at least one "/" and one other character following the "/", but
try other names too. See now if it is listed (it should be).

Amit

On Feb 10, 9:59 am, Jeff  Mancuso <[email protected]> wrote:
> 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