Keep desktop previews visible and open project sources before compiling

This commit is contained in:
gloamxun committed 2026-12-02 12:55:35 +08:00
1 parent a2c4a2b3a9
commit 68e5260d40
7 files changed
+357 -130

No files matched your search

+6 -15
View File
@@ -1,4 +1,4 @@
use super::{EditorSession, InputProfile, fs, json, prepare, projects::ProjectStore, reply};
use super::{InputProfile, OpeningEditor, fs, json, projects::ProjectStore, reply, stage_sources};
use std::{
io::{ErrorKind, Read},
path::{Path, PathBuf},
@@ -104,7 +104,7 @@ impl Library {
}
}
pub(super) fn open(&self, id: &str) -> Result<EditorSession, Box<dyn std::error::Error>> {
pub(super) fn open(&self, id: &str) -> Result<OpeningEditor, Box<dyn std::error::Error>> {
let root = self.store.project_dir(id)?;
if fs::symlink_metadata(&root)?.file_type().is_symlink() {
return Err("The project directory must be a local working copy".into());
@@ -121,19 +121,10 @@ impl Library {
.map(|file| PathBuf::from(&file.path))
.collect::<Vec<_>>();
let run = fresh_run(&self.runs, id)?;
let mut session = EditorSession::new(run, |run| {
prepare(
&root,
&source,
&self.format,
&self.manifest,
run,
&files,
self.profile,
)
})?;
session.id = Some(info.id);
Ok(session)
let staged = stage_sources(
&root, &source, &self.format, &self.manifest, &run, &files, self.profile,
)?;
OpeningEditor::start(info.id, run, staged)
}
}