You've already forked AstralRinth
forked from didirus/AstralRinth
0.8.0 beta fixes (#2154)
* initial fixes * 0.8.0 beta fixes * run actions * run fmt * Fix windows build * Add purge cache opt * add must revalidate to project req * lint + clippy * fix processes, open folder * Update migrator to use old launcher cache for perf * fix empty dirs not moving * fix lint + create natives dir if not exist * fix large request batches * finish * Fix deep linking on mac * fix comp err * fix comp err (2) --------- Signed-off-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
@@ -174,8 +174,7 @@ async fn load_instance_cfg(file_path: &Path) -> crate::Result<MMCInstance> {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
|
||||
// #[tracing::instrument]
|
||||
pub async fn import_mmc(
|
||||
mmc_base_path: PathBuf, // path to base mmc folder
|
||||
instance_folder: String, // instance folder in mmc_base_path
|
||||
|
||||
@@ -104,7 +104,7 @@ pub async fn get_importable_instances(
|
||||
// Import an instance from a launcher type and base path
|
||||
// Note: this *deletes* the submitted empty profile
|
||||
|
||||
#[tracing::instrument]
|
||||
// #[tracing::instrument]
|
||||
pub async fn import_instance(
|
||||
profile_path: &str, // This should be a blank profile
|
||||
launcher_type: ImportLauncherType,
|
||||
@@ -257,7 +257,7 @@ pub async fn copy_dotminecraft(
|
||||
crate::api::profile::get_full_path(profile_path_id).await?;
|
||||
|
||||
// Gets all subfiles recursively in src
|
||||
let subfiles = get_all_subfiles(&dotminecraft).await?;
|
||||
let subfiles = get_all_subfiles(&dotminecraft, true).await?;
|
||||
let total_subfiles = subfiles.len() as u64;
|
||||
|
||||
let loading_bar = init_or_edit_loading(
|
||||
@@ -297,20 +297,33 @@ pub async fn copy_dotminecraft(
|
||||
|
||||
#[async_recursion::async_recursion]
|
||||
#[tracing::instrument]
|
||||
pub async fn get_all_subfiles(src: &Path) -> crate::Result<Vec<PathBuf>> {
|
||||
pub async fn get_all_subfiles(
|
||||
src: &Path,
|
||||
include_empty_dirs: bool,
|
||||
) -> crate::Result<Vec<PathBuf>> {
|
||||
if !src.is_dir() {
|
||||
return Ok(vec![src.to_path_buf()]);
|
||||
}
|
||||
|
||||
let mut files = Vec::new();
|
||||
let mut dir = io::read_dir(&src).await?;
|
||||
|
||||
let mut has_files = false;
|
||||
while let Some(child) = dir
|
||||
.next_entry()
|
||||
.await
|
||||
.map_err(|e| IOError::with_path(e, src))?
|
||||
{
|
||||
has_files = true;
|
||||
let src_child = child.path();
|
||||
files.append(&mut get_all_subfiles(&src_child).await?);
|
||||
files.append(
|
||||
&mut get_all_subfiles(&src_child, include_empty_dirs).await?,
|
||||
);
|
||||
}
|
||||
|
||||
if !has_files && include_empty_dirs {
|
||||
files.push(src.to_path_buf());
|
||||
}
|
||||
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
@@ -177,31 +177,25 @@ pub async fn install_zipped_mrpack_files(
|
||||
|
||||
let path =
|
||||
std::path::Path::new(&project_path).components().next();
|
||||
if let Some(path) = path {
|
||||
match path {
|
||||
Component::CurDir | Component::Normal(_) => {
|
||||
let path =
|
||||
profile::get_full_path(&profile_path)
|
||||
.await?
|
||||
.join(&project_path);
|
||||
if let Some(Component::CurDir | Component::Normal(_)) = path
|
||||
{
|
||||
let path = profile::get_full_path(&profile_path)
|
||||
.await?
|
||||
.join(&project_path);
|
||||
|
||||
cache_file_hash(
|
||||
file.clone(),
|
||||
&profile_path,
|
||||
&project_path,
|
||||
project
|
||||
.hashes
|
||||
.get(&PackFileHash::Sha1)
|
||||
.map(|x| &**x),
|
||||
&state.pool,
|
||||
)
|
||||
.await?;
|
||||
cache_file_hash(
|
||||
file.clone(),
|
||||
&profile_path,
|
||||
&project_path,
|
||||
project
|
||||
.hashes
|
||||
.get(&PackFileHash::Sha1)
|
||||
.map(|x| &**x),
|
||||
&state.pool,
|
||||
)
|
||||
.await?;
|
||||
|
||||
write(&path, &file, &state.io_semaphore)
|
||||
.await?;
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
write(&path, &file, &state.io_semaphore).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user