These utility functions have nothing to do with user and config dir/file. Move them to a separate file.