1
0

Compiler improvements (#145)

* Initial bug fixes

* fix compile error on non-mac

* Fix even more bugs

* Fix more

* fix more

* fix build

* fix build

* working basic

* removed zip

* working functions

* merge fixes

* fixed loadintg bar bug

* changed to one layer deep

* forge version numbers

* improvements + refactoring

* renamed things to fit plugin

* fixed bugs

* removed println

* overrides dont include mrpack

* merge

* fixes

* fixes

* fixed deletion

* merge errors

* force sync before export

* removed testing

* missed line

* removed console log

* mac error reverted

* incoreclty named helper

* added to new register method

* review changes

* minor changes

* moved create pack

* renamed function

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-06-28 09:58:58 -07:00
committed by GitHub
parent 47970d932b
commit f52e777379
38 changed files with 1047 additions and 896 deletions

View File

@@ -224,7 +224,40 @@ impl Profile {
pub fn sync_projects_task(path: PathBuf) {
tokio::task::spawn(async move {
let res = Self::sync_projects_inner(path).await;
let res = async {
let state = State::get().await?;
let profile = crate::api::profile::get(&path, None).await?;
if let Some(profile) = profile {
let paths = profile.get_profile_project_paths()?;
let projects = crate::state::infer_data_from_files(
profile.clone(),
paths,
state.directories.caches_dir(),
&state.io_semaphore,
&state.fetch_semaphore,
)
.await?;
let mut new_profiles = state.profiles.write().await;
if let Some(profile) = new_profiles.0.get_mut(&path) {
profile.projects = projects;
}
emit_profile(
profile.uuid,
profile.path,
&profile.metadata.name,
ProfilePayloadType::Synced,
)
.await?;
} else {
tracing::warn!(
"Unable to fetch single profile projects: path {path:?} invalid",
);
}
Ok::<(), crate::Error>(())
}.await;
match res {
Ok(()) => {}
Err(err) => {
@@ -236,42 +269,6 @@ impl Profile {
});
}
pub async fn sync_projects_inner(path: PathBuf) -> crate::Result<()> {
let state = State::get().await?;
let profile = crate::api::profile::get(&path, None).await?;
if let Some(profile) = profile {
let paths = profile.get_profile_project_paths()?;
let projects = crate::state::infer_data_from_files(
profile.clone(),
paths,
state.directories.caches_dir(),
&state.io_semaphore,
&state.fetch_semaphore,
)
.await?;
let mut new_profiles = state.profiles.write().await;
if let Some(profile) = new_profiles.0.get_mut(&path) {
profile.projects = projects;
}
emit_profile(
profile.uuid,
profile.path,
&profile.metadata.name,
ProfilePayloadType::Synced,
)
.await?;
} else {
tracing::warn!(
"Unable to fetch single profile projects: path {path:?} invalid",
);
}
Ok::<(), crate::Error>(())
}
pub fn get_profile_project_paths(&self) -> crate::Result<Vec<PathBuf>> {
let mut files = Vec::new();
let mut read_paths = |path: &str| {