improved: cm-cli.py save-snapshot - validate output path

fixed: Update all - Properly display the results of the ComfyUI update.
fixed: Update all - An issue where the action results of the custom nodes manager were reflected in the main dialog.

https://github.com/ltdrdata/ComfyUI-Manager/issues/1548
This commit is contained in:
Dr.Lt.Data
2025-02-15 09:00:00 +09:00
parent d7af7e2917
commit 3b0709f5f2
5 changed files with 43 additions and 12 deletions

View File

@@ -1021,7 +1021,17 @@ def save_snapshot(
] = True,
):
cmd_ctx.set_user_directory(user_directory)
path = core.save_snapshot_with_postfix('snapshot', output, not full_snapshot)
if(not output.endswith('.json') and not output.endswith('.yaml')):
print("ERROR: output path should be either '.json' or '.yaml' file.")
raise typer.Exit(code=1)
dir_path = os.path.dirname(output)
if(dir_path != '' and not os.path.exists(dir_path)):
print(f"ERROR: {output} path not exists.")
raise typer.Exit(code=1)
path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output, not full_snapshot))
print(f"Current snapshot is saved as `{path}`")