How to get the parent directory of a path

hello everyone,

I found that uxp can’t fully support the path module in nodejs, so now I don’t know how to get the parent of a path,

for example

path=“c:/abc/a.psd”

The result I want:

“c:/abc”

Try this

const path = "c:/abc/a.psd"
path.split("/").slice(0, -1).join("/");

You could try using GitHub - browserify/path-browserify: The path module from Node.js for browsers. Note, however, that even if you extract the parent folder’s name, you’re not able to arbitrarily reach out into it, unless you’ve obtained that entry via a file picker or the UXP file API.