On 8/6/07, Amit Singh <[EMAIL PROTECTED]> wrote:
> Moreover, the Finder info etc. can affect many
> things besides custom icons--you wouldn't want an "icon" module to
> deal with all these things. If it doesn't deal with other things, it
> would need to somehow "unionize" data from multiple sources when a
> "._" file is requested.
True -- in which case what about a more general cascading resource
fork handling mechanism? You could have a fusefm_getrsrc(const char
*path, const char *type, char *value, size_t size) which would be
called if fusefm_getxattr was not implemented or returned ENOENT for
"com.apple.ResourceFork", and a fusefm_geticns(const char *path, char
*value, size_t size) which would be called if fusefm_getrsrc was not
implemented or returned ENOENT for "icns".
If I were to write such code, would you consider using it? Then I
think handling of icons would be straightforward:
// e.g. implementation for FUSEObjC
static int fusefm_geticon(const char *path, char *value, size_t size) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int res = -ENOENT; // TODO: How to return error here?
@try {
NSData *data = [manager iconDataForPath:[NSString
stringWithUTF8String:path]];
res = [data length]; // default to returning size of buffer.
if (value) {
if (size > [data length]) {
size = [data length];
}
[data getBytes:&value length:size];
res = size; // bytes read
}
}
@catch (NSException * e) {
}
[pool release];
return res;
}
// e.g. implementation for HelloFuse:
- (NSData *)iconDataForPath:(NSString *)path
{
if ([path isEqualToString:helloPath])
return [NSData dataWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:@"hellodoc" ofType:@"icns"]];
else
return [super iconDataForPath:path];
}
> Anyway, there are other, more pressing things to do, so maybe in the
> future.
Of course.
> FUSEObjC is still a "demo" API--hopefully over time it will improve in
> flexibility, features, and ease of use.
I have no complaint whatsoever with FUSEObjC -- it makes serving
custom icons very easy. I thought perhaps though that this ease of use
could be transferred to other filesystems not using Objective-C.
Best wishes,
Hamish
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"macfuse-devel" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---