Locate current directory in a script

Hello, I’m working on a script that takes an open file, copies some of its contents into a new file, and then saves this new file into the same directory as the old file.

I’ve gotten those 2 first things to work, but I’m having difficulty with that last one thing, mainly because I can’t find a function in the documentation that can return the folder of a specific file.

I’ve spent a really long time reading the documentation and I probably just missed it, so I would appreciate some help.

Thanks a lot!

If you know the open or active sprite’s filename (full path + filename with extension) you can use this

For example:


will print the active sprite’s path.

And you can pass any path to that function. It doesn’t have to be aseprite supported/specific files (like a png).

1 Like

Thank you! This is exactly what I needed.