storkit: merge 457_bug_store_json_created_at_project_root_instead_of_inside_storkit

This commit is contained in:
dave
2026-04-02 13:24:15 +00:00
parent 46d09d4d45
commit 967a306ea8
3 changed files with 20 additions and 5 deletions
+11 -1
View File
@@ -139,8 +139,18 @@ async fn main() -> Result<(), std::io::Error> {
let app_state = Arc::new(SessionState::default());
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
// Migrate legacy root-level store.json into .storkit/ if the new path does
// not yet exist. This keeps existing deployments working after upgrade.
let legacy_store_path = cwd.join("store.json");
let store_path = cwd.join(".storkit").join("store.json");
if legacy_store_path.exists() && !store_path.exists() {
if let Some(parent) = store_path.parent() {
let _ = std::fs::create_dir_all(parent);
}
let _ = std::fs::rename(&legacy_store_path, &store_path);
}
let store = Arc::new(
JsonFileStore::from_path(PathBuf::from("store.json")).map_err(std::io::Error::other)?,
JsonFileStore::from_path(store_path).map_err(std::io::Error::other)?,
);
// Collect CLI args, skipping the binary name (argv[0]).