Skip to main content
Inspiring
August 5, 2019
Question

User TEMP folder. Mac & PC

  • August 5, 2019
  • 3 replies
  • 5099 views

Hi,

In my script i write some data to:

File($.getenv("TEMP")

This is working for PC.

Is this the correct variable for user tempo dir on MAC?

Dan

This topic has been closed for replies.

3 replies

Participant
November 14, 2021

You can use the following code to get the Platform-Specific path of Default Temporary folder:

var tempFolder = Folder.temp.fsName;
alert(tempFolder); // Check the Path of Folder

 

JJMack
Community Expert
Community Expert
August 5, 2019

Read the JavaScript-Tools-Guide-CC.pdf about the differences between PC and Mac files systems Temp will work on PC I doe not know where users temp file would be on a Mac

JJMack
karpiyonAuthor
Inspiring
August 5, 2019

Then what would you use as a writable temp folder on mac?

os = $.os.toLowerCase().indexOf('mac') >= 0 ? "MAC": "WINDOWS";

if(os == "WINDOWS"){

var tmpFile = File($.getenv("TEMP") + "/tmpFile.txt");

}else{

var tmpFile = File(??? + "/tmpFile.txt");

}

Stephen Marsh
Community Expert
Community Expert
August 5, 2019

I am new to scripting, so the only cross-platform folder that I know of is:

var saveFolder = "~/Desktop";

Stephen Marsh
Community Expert
Community Expert
August 5, 2019

I’d need a working code snippet to test.