Merge beta into release #21

Merged
didirus merged 276 commits from beta into release 2025-11-01 13:04:25 +00:00
Showing only changes of commit e7d933411e - Show all commits
+24 -30
View File
@@ -170,38 +170,22 @@ pub(crate) async fn watch_profile(
let profile_path = dirs.profiles_dir().join(profile_path); let profile_path = dirs.profiles_dir().join(profile_path);
if profile_path.exists() && profile_path.is_dir() { if profile_path.exists() && profile_path.is_dir() {
for sub_path in ProjectType::iterator().map(|x| x.get_folder()).chain([ for sub_path in ProjectType::iterator()
"crash-reports", .map(|x| x.get_folder())
"saves", .chain(["crash-reports", "saves"])
"servers.dat", {
]) {
let full_path = profile_path.join(sub_path); let full_path = profile_path.join(sub_path);
if !full_path.exists() && !full_path.is_symlink() { if !full_path.exists()
if !sub_path.contains(".") { && !full_path.is_symlink()
if let Err(e) = && !sub_path.contains(".")
crate::util::io::create_dir_all(&full_path).await && let Err(e) =
{ crate::util::io::create_dir_all(&full_path).await
tracing::error!( {
"Failed to create directory for watcher {full_path:?}: {e}" tracing::error!(
); "Failed to create directory for watcher {full_path:?}: {e}"
return; );
} return;
} else if sub_path == "servers.dat" {
const EMPTY_NBT: &[u8] = &[
10, // Compound tag
0, 0, // Empty name
0, // End of compound tag
];
if let Err(e) =
crate::util::io::write(&full_path, EMPTY_NBT).await
{
tracing::error!(
"Failed to create file for watcher {full_path:?}: {e}"
);
return;
}
}
} }
let mut watcher = watcher.write().await; let mut watcher = watcher.write().await;
@@ -215,6 +199,16 @@ pub(crate) async fn watch_profile(
return; return;
} }
} }
let mut watcher = watcher.write().await;
if let Err(e) = watcher
.watcher()
.watch(&profile_path, RecursiveMode::NonRecursive)
{
tracing::error!(
"Failed to watch root profile directory for watcher {profile_path:?}: {e}"
);
}
} }
} }