style: updated core dependency style
This commit is contained in:
parent
912e61e912
commit
7fc9b9ddba
3 changed files with 9 additions and 22 deletions
|
@ -6,9 +6,12 @@ license = "GPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies.anime-game-core]
|
||||||
anime-game-core = { git = "https://github.com/an-anime-team/anime-game-core", tag = "1.4.5", features = ["genshin", "all"] }
|
git = "https://github.com/an-anime-team/anime-game-core"
|
||||||
|
tag = "1.4.5"
|
||||||
|
features = ["genshin", "all"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
dirs = "5.0.0"
|
dirs = "5.0.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl Group {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct Features {
|
pub struct Features {
|
||||||
/// Standard environment variables that are applied when you launch the game
|
/// Standard environment variables that are applied when you launch the game
|
||||||
///
|
///
|
||||||
|
@ -45,14 +45,6 @@ pub struct Features {
|
||||||
pub env: HashMap<String, String>
|
pub env: HashMap<String, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Features {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
env: HashMap::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&JsonValue> for Features {
|
impl From<&JsonValue> for Features {
|
||||||
fn from(value: &JsonValue) -> Self {
|
fn from(value: &JsonValue) -> Self {
|
||||||
let mut default = Self::default();
|
let mut default = Self::default();
|
||||||
|
@ -161,9 +153,7 @@ pub fn get_downloaded<T: Into<PathBuf>>(components: T, folder: T) -> anyhow::Res
|
||||||
let folder: PathBuf = folder.into();
|
let folder: PathBuf = folder.into();
|
||||||
|
|
||||||
for mut group in get_groups(components)? {
|
for mut group in get_groups(components)? {
|
||||||
group.versions = group.versions.into_iter()
|
group.versions.retain(|version| folder.join(&version.name).exists());
|
||||||
.filter(|version| folder.join(&version.name).exists())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
if !group.versions.is_empty() {
|
if !group.versions.is_empty() {
|
||||||
downloaded.push(group);
|
downloaded.push(group);
|
||||||
|
|
|
@ -190,12 +190,8 @@ impl Version {
|
||||||
self.features.clone()
|
self.features.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
else if let Some(features) = &group.features {
|
|
||||||
Some(features.to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
None
|
group.features.as_ref().map(|features| features.to_owned())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,9 +372,7 @@ pub fn get_downloaded<T: Into<PathBuf>>(components: T, folder: T) -> anyhow::Res
|
||||||
let folder: PathBuf = folder.into();
|
let folder: PathBuf = folder.into();
|
||||||
|
|
||||||
for mut group in get_groups(components)? {
|
for mut group in get_groups(components)? {
|
||||||
group.versions = group.versions.into_iter()
|
group.versions.retain(|version| folder.join(&version.name).exists());
|
||||||
.filter(|version| folder.join(&version.name).exists())
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
if !group.versions.is_empty() {
|
if !group.versions.is_empty() {
|
||||||
downloaded.push(group);
|
downloaded.push(group);
|
||||||
|
|
Loading…
Reference in a new issue