I use a personal password manager and the database is protected by a password and you have to provide a key file. To select the key file you click a file selection dropdown. A Finder window pops up and opens the folder I previously navigated to with this file dropdown and presents you the folder where I stored the key file. In terms of security, you understand this is not desirable behaviour.
Ideally I would want Finder to just open the default folder that pops up when I open a new Finder window. I would like to modify this behaviour for this specific application, but a system wide solution is also welcome. I don't mind clicking through several folders.
I am on a relatively fresh install of MacOS High Sierra 10.13.4 and I'm not afraid of tinkering with the Terminal or AppleScript. I just don't know where to start.
Best Answer
Alas, my question was not so popular that it inspired people to answer my question. But after rephrasing my google search terms and some investigation of my own. I found a solution to this.
It appears every application stores these previously opened folders as
defaults
, which is also the command you need in Terminal to see and reset this value.I stumbled upon this Quora answer which introduced me to the
defaults
command. It seems all you need is the bundle identifier of your application (in the source exampleorg.videolan.vlc
) and the namespace of the default you are trying to erase.I found the bundle identifier of my application by typing
lsof | grep [appname]
(which isn't very reliable, because the application name could differ slightly from the bundle identifier) and looking forLibrary
(which commonly hold folder names with these bundle identifiers) in the result. But you can also dodefaults read > defaults.log
and search the file for your the path of the folder you are trying to erase the default for.This led me to the namespace
NSNavLastRootDirectory
. So all I have to do is execute the commanddefaults delete com.bundle.identifier NSNavLastRootDirectory
everytime right before I open the application.How I am going to do that? I'm not sure yet. Probably some Applescript solution. Furthermore I was wondering if I used the right tags for this, since my question got so little attention.