Capture editor file dates and make desktop ZIP import observable

This commit is contained in:
gloamxun committed 2026-12-02 10:07:43 +08:00
1 parent 0ea71d57a9
commit fbc339f5c4
11 files changed
+231 -72

No files matched your search

+7 -4
View File
@@ -12,7 +12,6 @@ use std::{
use tauri::{Manager, RunEvent, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
const DISTRO: &str = "FedoraLinux-44";
const HIDE_CONSOLE: u32 = 0x08000000;
const READY_PREFIX: &str = "Native editor ";
@@ -41,7 +40,10 @@ impl Backend {
fn wsl() -> Command {
let mut command = Command::new("wsl.exe");
command.creation_flags(HIDE_CONSOLE);
command.args(["--distribution", DISTRO, "--exec"]);
if let Some(distribution) = std::env::var_os("TEXRRA_WSL_DISTRO").filter(|d| !d.is_empty()) {
command.arg("--distribution").arg(distribution);
}
command.arg("--exec");
command
}
@@ -50,7 +52,7 @@ fn linux_path(path: &Path) -> Result<String, String> {
.args(["wslpath", "-a", "-u"])
.arg(path)
.output()
.map_err(|e| format!("无法打开 {DISTRO}。{e}"))?;
.map_err(|e| format!("无法启动 Windows 的 WSL 环境。{e}"))?;
if !result.status.success() {
return Err(format!(
"无法读取桌面版引擎资源。{}",
@@ -113,7 +115,7 @@ fn start_engine(backend: &Backend, launcher: &Path) -> Result<Url, String> {
.map_err(|error| match error {
mpsc::RecvTimeoutError::Timeout => "启动本地引擎超时。".to_owned(),
mpsc::RecvTimeoutError::Disconnected => {
format!("本地引擎启动失败。请确认 {DISTRO} 可以正常打开。")
"本地引擎启动失败。请确认当前默认的 WSL 发行版可以正常打开。".to_owned()
}
})?
}
@@ -156,6 +158,7 @@ fn main() {
.title("Texrra")
.inner_size(1280.0, 900.0)
.min_inner_size(780.0, 540.0)
.disable_drag_drop_handler()
.on_navigation(move |url| {
matches!(
url.as_str(),