How to set file prompt working directory

Is there anyway in the API to set the save / open dialog prompts working directory without specifying it during the dialog creation?

I know that it can be set like this:

defaultPath: ‘asdf’,


But I’m looking for a way to set this defaultPath in the same way that opening or saving a file does. Which then let’s me leave this value undefined and things work the usual way. I’m trying to avoid having to wrap this method and keep track of this myself, so that I can set this in a particular instance but still allow the user’s last opened / save to directory to be the default path.