Skip to content

Commit

Permalink
enabled in mod-list.json is a proper boolean now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnavion committed May 5, 2017
1 parent 3d85a19 commit ad35af3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions factorio-mods-local/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl API {
Err(err) => bail!(::ErrorKind::FileIO(mod_list_file_path.into(), err)),
};
let mod_list: ModList = ::serde_json::from_reader(mod_list_file).map_err(|err| ::ErrorKind::ReadJSONFile(mod_list_file_path.into(), err))?;
Ok(mod_list.mods.into_iter().map(|m| (m.name, m.enabled == "true")).collect())
Ok(mod_list.mods.into_iter().map(|m| (m.name, m.enabled)).collect())
}

fn save_mod_status(&self, mod_status: &::std::collections::HashMap<::factorio_mods_common::ModName, bool>) -> ::Result<()> {
Expand All @@ -143,7 +143,7 @@ impl API {

let mut mods: Vec<_> =
mod_status.into_iter()
.map(|(name, &enabled)| ModListMod { name: name.clone(), enabled: if enabled { "true".to_string() } else { "false".to_string() } })
.map(|(name, &enabled)| ModListMod { name: name.clone(), enabled })
.collect();
mods.sort_by(|mod1, mod2| mod1.name.cmp(&mod2.name));

Expand Down Expand Up @@ -215,7 +215,7 @@ struct ModList {
#[derive(Debug, Deserialize, Serialize)]
struct ModListMod {
name: ::factorio_mods_common::ModName,
enabled: String,
enabled: bool,
}

/// Represents the contents of `base/info.json`
Expand Down

0 comments on commit ad35af3

Please sign in to comment.