Skip to main content
dbDavideBoscolo
Legend
July 31, 2023
Answered

How to use Folder.userData properly

  • July 31, 2023
  • 1 reply
  • 438 views

Hi all,

 

I'm trying to understand how to properly write a few lines of code involving Folder.userData.

When I declare a folder path which of the following is correct?

 

 

 

var myFolderPath = Folder.userData + encordeURI("/MyFolder");
var myFolderPath = Folder.userData.absoluteURI + encordeURI("/MyFolder");
var myFolderPath = Folder.userData.relativeURI + encodeURI("/MyFolder");

 

 

 

They all seem to work. Which is the best choice though?

 

Then, I'll continue with the following:

 

 

 

var myFolder = new Folder(myFolderPath);

 

 

 

 

This topic has been closed for replies.
Correct answer Dan Ebberts

Since it's a Folder object, I think I'd do it this way:

var myFolderPath = Folder.userData.path + "/" + Folder.userData.name + encodeURI("/myFolder");

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
August 1, 2023

Since it's a Folder object, I think I'd do it this way:

var myFolderPath = Folder.userData.path + "/" + Folder.userData.name + encodeURI("/myFolder");

dbDavideBoscolo
Legend
August 2, 2023

Hi Dan, thank you for answering!

 

It looks like any of the following return the same string:

Folder.userData.path + "/" + Folder.userData.name
Folder.userData.absoluteURI