storkit: merge 457_bug_store_json_created_at_project_root_instead_of_inside_storkit
This commit is contained in:
+11
-1
@@ -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]).
|
||||
|
||||
Reference in New Issue
Block a user