feat(debug): 支持 --new 参数创建全新调试存档

添加  选项,启动调试时自动生成带时间戳的新存档目录
(格式 MC_DEV_WORLD_YYYYMMDD_HHMMSS)并持久化到 .mcdev.json。

- 新增 local_timestamp_compact() 跨平台本地时间格式化
- 新增 allocate_new_world() 更新配置并落盘
- 补充单元测试验证存档名格式与持久化正确性
This commit is contained in:
2026-05-16 17:24:13 +08:00
parent 011b59c948
commit fd79a99477
6 changed files with 140 additions and 3 deletions

View File

@@ -13,8 +13,14 @@ use std::path::Path;
use crate::error::Result;
pub fn run(project_dir: &Path) -> Result<()> {
pub fn run(project_dir: &Path, new_world: bool) -> Result<()> {
let mut config = config::load_or_create(project_dir)?;
if new_world && !config::env_is_subprocess_mode() {
config::allocate_new_world(project_dir, &mut config)?;
println!("[MCDK] 创建新存档:{}", config.world_folder_name);
}
config::ensure_game_executable(project_dir, &mut config)?;
let mod_dirs = config.included_mod_dirs(project_dir)?;