message: Fix bug in filesystem::write_config, update CONFIG_NAME
diff: @@ -41,7 +41,7 @@ use GameResult;
  use conf;
  use vfs::{self, VFS};
  -const CONFIG_NAME: &'static str = "conf.toml";
  +const CONFIG_NAME: &'static str = "/conf.toml";
  /// A structure that contains the filesystem state and cache.
  #[derive(Debug)]
  @@ -298,11 +298,12 @@ impl Filesystem {
  /// overwriting any file already there.
  pub fn write_config(&mut self, conf: &conf::Conf) -> GameResult<()> {
  let conf_path = path::Path::new(CONFIG_NAME);
  - if self.is_file(conf_path) {
  let mut file = self.create(conf_path)?;
  - conf.to_toml_file(&mut file)
  + let f = conf.to_toml_file(&mut file)?;
  + if self.is_file(conf_path) {
  + Ok(f)
  } else {
  - Err(GameError::ConfigError(String::from("Could not write config file because a directory is in the way?")))
  + Err(GameError::ConfigError(format!("Failed to write config file at {}", conf_path.to_string_lossy())))
  }
  }
  }
  @@ -315,6 +316,7 @@ mod tests {
  use vfs::*;
  use std::path;
  use std::io::{Read, Write};
  + use conf;
  fn get_dummy_fs_for_tests() -> Filesystem {
  let mut path = path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
  @@ -333,6 +335,20 @@ mod tests {
  }
  + #[test]
  + fn test_write_config() {
  + let mut f = get_dummy_fs_for_tests();
  + let mut conf = conf::Conf::new();
  + // The config file should end up in
  + // the resources directory with this
  + match f.write_config(&conf) {
  + Ok(f) => (),
  + Err(e) => panic!("{:?}", e),
  + }
  + // Remove the config file!
  + f.delete(CONFIG_NAME);
  + }
  +
  #[test]
  fn test_file_exists() {
  let mut f = get_dummy_fs_for_tests();
  