Safer usage of mkdir across the project

This commit is contained in:
oobabooga 2025-06-17 07:09:33 -07:00
parent 8689d7ecea
commit 0d1597616f
16 changed files with 240 additions and 206 deletions

View file

@ -160,7 +160,8 @@ def get_available_presets():
def get_available_prompts():
notebook_dir = Path('user_data/logs/notebook')
notebook_dir.mkdir(parents=True, exist_ok=True)
if not notebook_dir.exists():
notebook_dir.mkdir(parents=True, exist_ok=True)
prompt_files = list(notebook_dir.glob('*.txt'))
sorted_files = sorted(prompt_files, key=lambda x: x.stat().st_mtime, reverse=True)