Fixed this bug (including '\0\0\0\0' in the set of the plug-in's file types) and removed the warning about it.
authorPeter Hosey <hg@boredzo.org>
Sat Oct 10 12:01:18 2009 -0700 (2009-10-10)
changeset 44999fefef3a977e
parent 4498 bed4a154b38f
child 4500 37955381cd55
Fixed this bug (including '\0\0\0\0' in the set of the plug-in's file types) and removed the warning about it.
Core/Source/GrowlPluginController.m
     1.1 --- a/Core/Source/GrowlPluginController.m	Sat Oct 10 11:57:34 2009 -0700
     1.2 +++ b/Core/Source/GrowlPluginController.m	Sat Oct 10 12:01:18 2009 -0700
     1.3 @@ -376,7 +376,8 @@
     1.4  	if (!path)
     1.5  		path = [bundle bundlePath];
     1.6  	NSString *extension = [path pathExtension];
     1.7 -	NSString *fileType = nil;
     1.8 +	NSString *fileTypeString = nil;
     1.9 +	OSType fileType = 0;
    1.10  
    1.11  	//Assert that we have a name, author, and version. (We got the path first so we can use it in the assertion message.)
    1.12  	NSAssert5((name != nil) && (author != nil) && (version != nil),
    1.13 @@ -441,19 +442,18 @@
    1.14  		if (description)
    1.15  			[pluginDict setObject:description forKey:GrowlPluginInfoKeyDescription];
    1.16  
    1.17 -		[[NSWorkspace sharedWorkspace] getFileType:&fileType creatorCode:NULL forFile:path];
    1.18 +		[[NSWorkspace sharedWorkspace] getFileType:&fileTypeString creatorCode:NULL forFile:path];
    1.19 +		fileType = fileTypeString ? NSHFSTypeCodeFromFileType(fileTypeString) : 0;
    1.20  
    1.21  		//Record the file types (HFS and filename extension) that the plug-in possessed at this time. These help determine what kind of plug-in it is (e.g. .growlView = custom view; .growlStyle = WebKit display).
    1.22  		NSSet *types = nil;
    1.23  		if (extension) {
    1.24 -#warning problem here...
    1.25 -			///XXX when there is no file type it is coming back as \'\'...im guessing this means no type, but it still tests as true so each plugin is registered against that type...wrong???
    1.26  			if (fileType)
    1.27 -				types = [NSSet setWithObjects:extension, fileType, nil];
    1.28 +				types = [NSSet setWithObjects:extension, fileTypeString, nil];
    1.29  			else
    1.30  				types = [NSSet setWithObject:extension];
    1.31  		} else if (fileType)
    1.32 -			types = [NSSet setWithObject:fileType];
    1.33 +			types = [NSSet setWithObject:fileTypeString];
    1.34  
    1.35  		if (types)
    1.36  			[pluginDict setObject:types forKey:GrowlPluginInfoKeyTypes];
    1.37 @@ -491,7 +491,7 @@
    1.38  		ADD_TO_DICT(pluginsByFilename, [path lastPathComponent], pluginDict);
    1.39  
    1.40  		ADD_TO_DICT(pluginsByType, extension, pluginDict);
    1.41 -		ADD_TO_DICT(pluginsByType, fileType,  pluginDict);
    1.42 +		ADD_TO_DICT(pluginsByType, fileTypeString,  pluginDict);
    1.43  	#undef ADD_TO_DICT
    1.44  	}
    1.45