[C API] Get texture full path

In the Ruby API, we have texture.filename:

The filename method retrieves the entire path, including the file, for a texture object.

In the C API, we have SUTextureGetFileName():

A full path may be stored with the texture, but this method will always return a file name string with no path.

Why is that?
Is there a way to retrieve the full path of a texture in the C API?

I have no idea why that function return the basename. It’s easy enough to extract that from the full path, so it would have been better to return that.

I’m not seeing any other way to obtain the full path either.

1 Like

And it’s even worse if the texture was created from an SUImageRepRef as then the filename contains only the file extension (ie, ".png".)

SUImageRepRef also lacks a file path getter function (which should return a full path once an image file is loaded to or saved from the SUImageRepRef object.)

Should I file a bug report for the current method, or a feature request for a new separate method? eg SUTextureGetFilePath()

I’d be cautious of doing this as I recently found some potentially damaging ‘links’ imbedded as texture paths [including php paths] in skm files from one of the ‘free texture repositories’…

I use the returned name to check for a local file and write on out if it doesn’t exist…

john

Because the SUTextureGetFileName() function has specific varying behavior (purposely designed,) … it is likely best to file FRs for new functions:

  • SUTextureGetFilePath()

and

  • SUImageRepGetFilePath()

Ca you elaborate? Example?

the most recent one was from misbehaving model [on the users mac] and one ‘texture.filename’ ended .php.jpg

I didn’t investigate, what may have or not been inside, I just exacted the pixel data, and the stats and created a new skm…

it was one of about 50 materials in the model with only three or four had the user’s local paths…

the file was reduced from 126 to 90 MB after I cleaned and optimised the skm’s…

john

I still don’t understand what the issue is… ? What is the damaging behaviour?