Move code from CreateConfiguredDatabase() and add XDG support. This implements an automatic Linux fallback for the setting "db_file" if none was specified.