Compare commits

...
Author SHA1 Message Date
Calum H. (IMB11) 8b1642cd21 fix: lint 2026-06-26 14:55:12 +01:00
Calum H. (IMB11) e1cf1e9db3 fix: logs using id not path 2026-06-26 12:06:07 +01:00
2 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ async fn main() -> theseus::Result<()> {
for world in worlds {
println!(
"World: {:?}/{:?} played at {:?}: {:#?}",
world.profile,
world.instance_id,
world.world.name,
world.world.last_played,
world.world.details
+27 -6
View File
@@ -250,9 +250,15 @@ impl Logs {
output: if clear_contents.unwrap_or(false) {
None
} else {
let state = State::get().await?;
Some(
get_output_by_filename(instance_path, log_type, &filename)
.await?,
get_output_by_filename_from_path(
&state,
instance_path,
log_type,
&filename,
)
.await?,
)
},
filename,
@@ -358,14 +364,12 @@ pub async fn get_logs_by_filename(
Logs::build(log_type, age, &instance_path, filename, Some(true)).await
}
#[tracing::instrument]
pub async fn get_output_by_filename(
async fn get_output_by_filename_from_path(
state: &State,
instance_path: &str,
log_type: LogType,
file_name: &str,
) -> crate::Result<CensoredString> {
let state = State::get().await?;
let logs_folder = match log_type {
LogType::InfoLog => state.directories.instance_logs_dir(instance_path),
LogType::CrashReport => {
@@ -409,6 +413,23 @@ pub async fn get_output_by_filename(
.into())
}
#[tracing::instrument]
pub async fn get_output_by_filename(
instance_id: &str,
log_type: LogType,
file_name: &str,
) -> crate::Result<CensoredString> {
let state = State::get().await?;
let instance_path = resolve_instance_path(instance_id, &state).await?;
get_output_by_filename_from_path(
&state,
&instance_path,
log_type,
file_name,
)
.await
}
#[tracing::instrument]
pub async fn delete_logs(instance_id: &str) -> crate::Result<()> {
let state = State::get().await?;