fix: full_decrypt 写入前自动创建输出目录

full_decrypt 打开 out_path 写入时未创建父目录,
首次运行 monitor_web 且 decrypted/ 不存在时会报
FileNotFoundError。

Fixes #22

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat/daemon-cli
ylytdeng 2026-03-10 17:21:11 +08:00
parent 030680eb85
commit 7020409543
1 changed files with 1 additions and 0 deletions

View File

@ -367,6 +367,7 @@ def full_decrypt(db_path, out_path, enc_key):
file_size = os.path.getsize(db_path) file_size = os.path.getsize(db_path)
total_pages = file_size // PAGE_SZ total_pages = file_size // PAGE_SZ
os.makedirs(os.path.dirname(out_path), exist_ok=True)
with open(db_path, 'rb') as fin, open(out_path, 'wb') as fout: with open(db_path, 'rb') as fin, open(out_path, 'wb') as fout:
for pgno in range(1, total_pages + 1): for pgno in range(1, total_pages + 1):
page = fin.read(PAGE_SZ) page = fin.read(PAGE_SZ)