You've already forked AstralRinth
forked from didirus/AstralRinth
Folder names (#318)
This commit is contained in:
@@ -2,7 +2,9 @@ use crate::config::MODRINTH_API_URL;
|
||||
use crate::data::ModLoader;
|
||||
use crate::event::emit::{emit_loading, init_loading};
|
||||
use crate::event::{LoadingBarId, LoadingBarType};
|
||||
use crate::state::{LinkedData, ModrinthProject, ModrinthVersion, SideType};
|
||||
use crate::state::{
|
||||
LinkedData, ModrinthProject, ModrinthVersion, ProfilePathId, SideType,
|
||||
};
|
||||
use crate::util::fetch::{
|
||||
fetch, fetch_advanced, fetch_json, write_cached_icon,
|
||||
};
|
||||
@@ -71,7 +73,7 @@ pub enum PackDependency {
|
||||
Minecraft,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase", tag = "type")]
|
||||
pub enum CreatePackLocation {
|
||||
FromVersionId {
|
||||
@@ -98,6 +100,7 @@ pub struct CreatePackProfile {
|
||||
pub skip_install_profile: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CreatePackDescription {
|
||||
pub file: bytes::Bytes,
|
||||
pub icon: Option<PathBuf>,
|
||||
@@ -105,7 +108,7 @@ pub struct CreatePackDescription {
|
||||
pub project_id: Option<String>,
|
||||
pub version_id: Option<String>,
|
||||
pub existing_loading_bar: Option<LoadingBarId>,
|
||||
pub profile: PathBuf,
|
||||
pub profile_path: ProfilePathId,
|
||||
}
|
||||
|
||||
pub fn get_profile_from_pack(
|
||||
@@ -158,13 +161,13 @@ pub async fn generate_pack_from_version_id(
|
||||
version_id: String,
|
||||
title: String,
|
||||
icon_url: Option<String>,
|
||||
profile: PathBuf,
|
||||
profile_path: ProfilePathId,
|
||||
) -> crate::Result<CreatePackDescription> {
|
||||
let state = State::get().await?;
|
||||
|
||||
let loading_bar = init_loading(
|
||||
LoadingBarType::PackFileDownload {
|
||||
profile_path: profile.clone(),
|
||||
profile_path: profile_path.get_full_path().await?,
|
||||
pack_name: title,
|
||||
icon: icon_url,
|
||||
pack_version: version_id.clone(),
|
||||
@@ -253,7 +256,7 @@ pub async fn generate_pack_from_version_id(
|
||||
project_id: Some(project_id),
|
||||
version_id: Some(version_id),
|
||||
existing_loading_bar: Some(loading_bar),
|
||||
profile,
|
||||
profile_path,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -261,7 +264,7 @@ pub async fn generate_pack_from_version_id(
|
||||
#[theseus_macros::debug_pin]
|
||||
pub async fn generate_pack_from_file(
|
||||
path: PathBuf,
|
||||
profile: PathBuf,
|
||||
profile_path: ProfilePathId,
|
||||
) -> crate::Result<CreatePackDescription> {
|
||||
let file = io::read(&path).await?;
|
||||
Ok(CreatePackDescription {
|
||||
@@ -271,6 +274,6 @@ pub async fn generate_pack_from_file(
|
||||
project_id: None,
|
||||
version_id: None,
|
||||
existing_loading_bar: None,
|
||||
profile,
|
||||
profile_path,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user