Hi!
I have a path to a texture file. I know everything but it's extension (.tif, .exr, .png, etc.). I need to check each to verify if the texture exists. Is there a VEX function that can verify if the texture exists?
-Olivier
VEX: Check if a texture file exists? {[SOLVED]}
724 2 0-
- olivierth
- Member
- 1177 posts
- Joined: April 2017
- Offline
-
- wyhinton1
- Member
- 95 posts
- Joined: Feb. 2020
- Offline
I think you can use file_stat() [www.sidefx.com] in this case?
This docs provide this example of using it:
In your case, I guess you would make an array of your possible file name endings and loop over it, checking if each version of the file exists. I don't suppose the function supports any "matching" syntax that would let you do a wildcard for the extension.
This docs provide this example of using it:
#include <file.h> v@Cd = {1,0,0}; stat s = file_stat("$HH/pic/Mandril.pic"); if (s->isValid()) v@Cd = {0,1,0};
In your case, I guess you would make an array of your possible file name endings and loop over it, checking if each version of the file exists. I don't suppose the function supports any "matching" syntax that would let you do a wildcard for the extension.
Edited by wyhinton1 - April 14, 2025 19:20:21
-
- olivierth
- Member
- 1177 posts
- Joined: April 2017
- Offline
-
- Quick Links

