SPXPlatPluginsSuite->GetPluginXplatFileSpec returns XPlatFileSpec with mFileReference==0x00

Hello

I am in the process of porting a legacy (CS5) Photoshop plugin for macOS written in C++ to current technology (Photoshop 2022, macOS 12.4).

I’m currently struggling with the fact that CFURLCreateFromFSRef is deprecated and should not be used any longer. Now, thanks to the newest version of the Plugins Suite, that shouldn’t be a problem, SPXPlatPluginsSuite should return an XPlatFileSpec, which gives the file location as a CFURLRef.

Unfortunately, if I acquire the suite with kSPPluginsSuite and kSPPluginsSuiteVersion6, then call GetPluginXplatFileSpec, the resulting XPlatFileSpec’s mFileReference is null, the mFileSpecVersion is 0.

If I use kSPPluginsSuiteVersion4 for the Suite acquisition, then call GetPluginFileSpecification, the resulting SPPlatformFileSpecification’s mReference contains the correct (but useless) FSRef.

What am I doing wrong here?

Found a way to do it:

Stick with kSPPluginsSuiteVersion4 and GetPluginFileSpecification, then use PSGetPathSuite1 to get the path out of the returned SPPlatformFileSpecification as a string. From there I can create the URL as needed.