Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Plugin and Companion App SDK
Viewing all articles
Browse latest Browse all 54282

Finding the path of your filter plugin programmatically?

$
0
0

Hi, I've been trying some time to get the path of my plugin so I can reference some resource files in a reliable manner (so no matter where my plugin is within the plugin directory it will work).  I've been trying to use the SP Suites to do this, but I can't seem to get them to work.

 

My short term goal is to print the path to my plugin binary to console.

My most recent attempt goes like this(from within doContinue):

 

    SPBasicSuite *sSPBasic = f->sSPBasic; //f being the global filter record passed in by photoshop

 

    SPAccessSuite *sSPAccess;

 

    SPErr error = sSPBasic->AcquireSuite(kSPAccessSuite,

      kSPAccessSuiteVersion, (const void**)&sSPAccess);

 

    if (error) {

        fprintf(stderr, "coudln't acquire access suite\n");

    } else {

        fprintf(stderr, "acquired access suite\n");

    }

 

    SPPluginRef thisPlugin = NULL;

 

    error = sSPAccess->GetCurrentPlugin(&thisPlugin);

 

    if (error) {

        fprintf(stderr, "coudln't get current plugin\n");

    } else {

        fprintf(stderr, "got current plugin\n");

    }

 

    SPPluginsSuite *sSPPlugins;

 

    error = sSPBasic->AcquireSuite(kSPPluginsSuite,

      kSPPluginsSuiteVersion, (const void**)&sSPPlugins);

 

    if (error) {

        fprintf(stderr, "coudln't acquire plugins suite\n");

    } else {

        fprintf(stderr, "acquired plugins suite\n");

    }

 

    SPPlatformFileSpecification *fileSpec;

 

    error = sSPPlugins->GetPluginFileSpecification(thisPlugin, fileSpec);

 

    if (error) {
        fprintf(stderr, "coudln't get file spec\n");
    } else {
        fprintf(stderr, "got file spec\n");
    }

 

    //fprintf(stderr, "%s\n", fileSpec->nothingherecompiles);

 

 

 

 

Which results in the following output from gdb:

acquired access suite
got current plugin
acquired plugins suite

 

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000008

 

Based on that it seems that GetPluginFileSpecification crashes the program.  However, I'm fairly certain that 'thisPlugin' is not actually valid either, which makes me question whether any of the suites are valid as well.  Is there some sort of initialization I'm missing?  Any help is much appreciated.


Viewing all articles
Browse latest Browse all 54282

Trending Articles