Spotlight plugin not working

Discussion in 'Mac Programming' started by vinner2112, Feb 15, 2011.

  1. vinner2112 macrumors newbie

    Joined:
    Feb 15, 2011
    #1
    hiiiiiiii....

    i'm ne to the xcode development environment and m developing the spotlight plugin for actionscript(.as) files and i hv developed all the code and debug it with the help of terminal.

    when i debug the plugin from terminal using the command :

    mdimport d2 <path of the .as file>

    it successfully imports the asctionscript.mdimporter.

    but when i start searching the contents from the spotlight the .as file will not displayed in the list of finder....

    m attaching the needed files...pls verify if have any problem wid dem.

    please help me....
     

    Attached Files:

  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    That code is importing a StickiesDatabase file. Did you upload the right code?
     
  3. vinner2112 thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #3
    No...these files are of .as plugin

    i have pasted the code from the stickies sample plugin...
    but info.plist and schema.xml are modified files...

    please resolve the problem if any...


    thanks as always...
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    You still need to modify the code in the .m file to extract the metadata from the file. You can't do it simply by editing the plist or xml files - those just describe information about the plugin.
     
  5. vinner2112 thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #5
    Spotlight Plugin not working

    i have mde the following changes to the .m file and it changes the metadata but while perform search through the finder it doesn't show the file in the finder..


    the code as follows:

    Code:
    Boolean GetMetadataForFile(void* thisInterface, 
    						   CFMutableDictionaryRef attributes, 
    						   CFStringRef contentTypeUTI,
    						   CFStringRef pathToFile)
    {
    	NSData *data;
    	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    	
    	// load the data from the file
    	data = [NSData dataWithContentsOfFile:(NSString *)pathToFile];
    	if (data == NULL) {
    		NSString *filesContent = [[NSString alloc] initWithContentsOfFile:@"/users/vinay/desktop/basicfunctions.as"];
    		[filesContent writeToFile:@"/mylog.txt" atomically:YES];
    		[pool release];
    		return FALSE;
        }
    	//NSString *s1=(NSString *)pathToFile;
    	//[attributes setValue:s1 forKey:(id)kMDItemDisplayName];
    	
    	CFDictionaryAddValue(attributes, CFSTR("public_archive_applesingle_Title"),@"ActionScript File");
    	
    	
    	[pool release];	
    	return TRUE;
    }
    thanks as alwayz...
     

Share This Page