You've already forked AstralRinth
forked from didirus/AstralRinth
Event handling (#75)
* working on amcros * fleshed out draft * added feature support * finished loading * Fixed issue with multiple data types in macro * Working, and added more loading uses * added window scopes * clippy, fmt * working other variants * fmt; clippy * prettier * refactored emissions to use increment * fixed deadlock * doc changes * clippy, prettier * uuid change * restructured events to util * loading restructure * merge fixes * comments mistake * better cfg tauri feature structuring * added extra fields to some loading enum variants * removed Option<> * added pack + version labels * doc change
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
//! Theseus profile management interface
|
||||
use crate::{jre, prelude::ModLoader};
|
||||
use crate::{
|
||||
event::{emit::emit_profile, ProfilePayloadType},
|
||||
jre,
|
||||
prelude::ModLoader,
|
||||
};
|
||||
pub use crate::{
|
||||
state::{JavaSettings, Profile},
|
||||
State,
|
||||
@@ -135,7 +139,8 @@ pub async fn profile_create(
|
||||
|
||||
// Fully canonicalize now that its created for storing purposes
|
||||
let path = canonicalize(&path)?;
|
||||
let mut profile = Profile::new(name, game_version, path.clone()).await?;
|
||||
let mut profile =
|
||||
Profile::new(uuid, name, game_version, path.clone()).await?;
|
||||
if let Some(ref icon) = icon {
|
||||
let bytes = tokio::fs::read(icon).await?;
|
||||
profile
|
||||
@@ -167,9 +172,16 @@ pub async fn profile_create(
|
||||
println!("Could not detect optimal JRE: {optimal_version_key}, falling back to system default.");
|
||||
}
|
||||
|
||||
emit_profile(
|
||||
uuid,
|
||||
path.clone(),
|
||||
&profile.metadata.name,
|
||||
ProfilePayloadType::Created,
|
||||
)
|
||||
.await?;
|
||||
{
|
||||
let mut profiles = state.profiles.write().await;
|
||||
profiles.insert(profile)?;
|
||||
profiles.insert(profile).await?;
|
||||
}
|
||||
|
||||
State::sync().await?;
|
||||
|
||||
Reference in New Issue
Block a user