Skip to main content
Legend
Nov 11, 2024 5:41 AM UTC
Answered

Getting correct path string for external disk

I am using ExtendScript as part of a cross-platform application such as Tauri or Electron. It is necessary to generate a POSIX path string from the File object so that it can be handled by that process.

 

ExtendScript's File.fullName can be handled normally on the local disk. However, on an external disk, it is different from the format required by the cross-platform application.

 

 

Expected Value

Actual Value

macOS

/Volumes/volume_name/path/to/file.ext

/volume_name/path/to/file.ext

Windows

D:/path/to/file.ext

/d/path/to/file.ext

 

Is there any way to get the path string indicated by Expected Value other than doing text replacement on my own?

This topic is closed to new replies. Start a new post to keep the conversation going.
jduncan
jduncanCorrect answer
Community Expert
Nov 11, 2024 7:03 PM UTC

`File.fsName` works for me on a Mac.

absoluteURI: /G-DRIVE/test/asu.jpg
fsName: /Volumes/G-DRIVE/test/asu.jpg
fullName: /G-DRIVE/test/asu.jpg

 

2 replies

jduncan
Community Expert
jduncanCommunity ExpertCorrect answer
Community Expert
Nov 11, 2024 7:03 PM UTC

`File.fsName` works for me on a Mac.

absoluteURI: /G-DRIVE/test/asu.jpg
fsName: /Volumes/G-DRIVE/test/asu.jpg
fullName: /G-DRIVE/test/asu.jpg

 

Translate
sttk3Author
Legend
Nov 12, 2024 12:48 AM UTC

Thank you, File.fsName worked for both macOS and Windows.

The format would be something like D:\path\to\file.ext on Windows, but the cross-platform application accepted that format when I tried it.

Translate