Skip to main content
Known Participant
November 15, 2023
Question

Extendscript and Absolute Paths for folders in home directory?

  • November 15, 2023
  • 1 reply
  • 344 views

I'm using PS2022 and PS2024 for testing on MacOS Ventura 13.6.

For some reason, Extendscript is not treating /Users/USERNAME/Desktop/FOLDER as an absolute path. This code (with a valid path) returns false when checking folder.exists:

var folder = new Folder('/Users/USERNAME/Desktop/FOLDER');
var files = folder.getFiles();

// Check if the folder exists
if (folder.exists) {
    alert("Folder exists.");
} else {
    alert("Folder does not exist.");
}

 

If the path is changed to this, then folder.exists returns true:

 

var folder = new Folder('/Volumes/Macintosh HD/Users/USERNAME/FOLDER');


When I use the function 'Folder.selectDialog' I get a string like the path in the first example - without Volumes/Drive - which should be a valid absolute path. In my previous testing it worked fine, but that was on a different machine.

 

If I need the Drive info in the path, how can I grab that?

Thanks in advance!

 

This topic has been closed for replies.

1 reply

Stephen Marsh
Community Expert
Community Expert
November 15, 2023

Just curious why you aren't using the more common relative path to the desktop?

 

'~/Desktop/FOLDER'