diff --git a/src/appstate.rs b/src/appstate.rs index 61a4847..ea58dff 100644 --- a/src/appstate.rs +++ b/src/appstate.rs @@ -585,6 +585,19 @@ impl AppState { } else { if let Some((prog, _)) = cmd.split_once(" ") { let mut launch_cmd = Command::new(prog); + match prog { + "konsole" => { + launch_cmd + .arg(format!("--workdir {}", project.files.display())); + } + "xfce4-terminal" => { + launch_cmd.arg(format!( + "--working-directory={}", + project.files.display() + )); + } + _ => {} + } match launch_cmd.spawn() { Ok(_) => {} Err(e) => { @@ -2084,8 +2097,12 @@ impl AppState { rid, String::from("[success] folders copied!"), )))?; - remove_dir_all(&new_project.files)?; - remove_dir_all(&new_project.notes)?; + let mut old_files = new_project.files.clone(); + let mut old_notes = new_project.notes.clone(); + old_files.pop(); + old_notes.pop(); + remove_dir_all(&old_files)?; + remove_dir_all(&old_notes)?; new_files_path.push(&new_project.name); new_notes_path.push(&new_project.name); new_project.files(new_files_path.clone()); @@ -2097,9 +2114,13 @@ impl AppState { )))?; self.main_tx.send(ToolMessage::Output(( rid, - String::from("creating distrobox..."), + String::from("checking if distrobox should be used..."), )))?; if let Some(mut db) = new_project.db { + self.main_tx.send(ToolMessage::Output(( + rid, + String::from("creating distrobox..."), + )))?; db.volumes = vec![ new_files_path.display().to_string(), new_notes_path.display().to_string(), @@ -2111,6 +2132,11 @@ impl AppState { rid, String::from("distrobox sent to rebuild function..."), )))?; + } else { + self.main_tx.send(ToolMessage::Output(( + rid, + String::from("Distrobox was not configured at the creation of this project, so no distrobox will be created."), + )))?; } new_project.save_config()?; self.projects[self.selected_project] = new_project;