Relative Paths
ChangelingChick
Posts: 3,210
I feel like I'm missing something really obvious here, but I've got a script that works as long as I use absolute paths. It's pretty simple. I just call 2 different files to apply them both. Is there a way to use relative paths? I can't find any documentation on the relative paths or sample code using them.
var oContentMgr = App.getContentMgr(); oContentMgr.openFile("C:/Users/CC/Documents/Secondary Runtimes/Ciara/People/test1.duf", true); oContentMgr.openFile("C:/Users/CC/Documents/Secondary Runtimes/Ciara/People/test2.duf", true);
Comments
Use
oAbsPath = oContentMgr.getAbsolutePath( "/People/test1.duf" )
Assuming that C:/Users/CC/Documents/Secondary Runtimes/Ciara is the content directory.
It is one of the content directories, but that doesn't seem to be working. Is there a way to get a script to get the absolute path to where it is located? And does that include the filename?
The line I gave will cause the Content Manager to tack the relative path given as an argument onto each of the content directory paths until it either finds a match or runs out of content directories. If it finds a match it returns the absolute path, if not it returns "". There's also an optional Boolean paarmeter which, if true, will cause DS to include the Import content directories.
Thank you so much! I finally got it working :D Now... if I could only remember why I needed it :D
Is that Connect safe?
Or better than this other version here?
https://www.daz3d.com/forums/discussion/172256/relative-paths-for-images-solved
Have a look at http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/file_io/file_find/start