It can be done from command line using xdg-mime - might be useful if weird programs are started
xdg-mime default nautilus.desktop inode/directory
These associations are kept in /usr/local/share/applications/mimeinfo.cache, ~/.local/share/applications/mimeinfo.cache, maybe also some other mime* file in those directories