diff --git a/apps/ai-game-creator-shell/.taurignore b/apps/ai-game-creator-shell/.taurignore new file mode 100644 index 000000000..8ec126556 --- /dev/null +++ b/apps/ai-game-creator-shell/.taurignore @@ -0,0 +1,4 @@ +# resources/plugins 由 build.rs 从 plugins/ 复制生成,属于构建产物。 +# 它在 dev 监听范围内,重新生成会让 Tauri dev 误判为源码改动而触发 +# “构建 -> 监听 -> 再构建”的自触发循环。 +resources/plugins/ diff --git a/apps/ai-game-creator-shell/src-tauri/.taurignore b/apps/ai-game-creator-shell/src-tauri/.taurignore new file mode 100644 index 000000000..8ec126556 --- /dev/null +++ b/apps/ai-game-creator-shell/src-tauri/.taurignore @@ -0,0 +1,4 @@ +# resources/plugins 由 build.rs 从 plugins/ 复制生成,属于构建产物。 +# 它在 dev 监听范围内,重新生成会让 Tauri dev 误判为源码改动而触发 +# “构建 -> 监听 -> 再构建”的自触发循环。 +resources/plugins/ diff --git a/apps/ai-game-creator-shell/src-tauri/build.rs b/apps/ai-game-creator-shell/src-tauri/build.rs index 4382abeef..e9f6642e0 100644 --- a/apps/ai-game-creator-shell/src-tauri/build.rs +++ b/apps/ai-game-creator-shell/src-tauri/build.rs @@ -293,6 +293,20 @@ fn stage_plugin_workspace(manifest_dir: &std::path::Path) { } } +#[cfg(windows)] +fn stage_plugin_file(source: &std::path::Path, destination: &std::path::Path) { + let Ok(bytes) = std::fs::read(source) else { + return; + }; + if std::fs::read(destination).is_ok_and(|existing| existing == bytes) { + return; + } + if let Some(parent) = destination.parent() { + std::fs::create_dir_all(parent).expect("创建插件资源目录失败"); + } + std::fs::write(destination, bytes).expect("复制插件资源失败"); +} + #[cfg(windows)] fn copy_plugin_tree(source: &std::path::Path, destination: &std::path::Path) { let entries = match std::fs::read_dir(source) { @@ -317,7 +331,7 @@ fn copy_plugin_tree(source: &std::path::Path, destination: &std::path::Path) { if name.contains(".test.") { continue; } - copy_plugin_file(&path, &target); + stage_plugin_file(&path, &target); } } }