make sure that the necessary directories exist, creating them if necessary
added function to create the config file when system configuration is done.
added write_config(), though this may be moved somewhere better.