Skip to content

Commit 34f3d73

Browse files
committed
chore: automatically create new directories, if valid year and date
1 parent 08e1886 commit 34f3d73

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ __pycache__/
1212
.idea/
1313
.cursor/
1414

15-
*.DS_Store/
16-
*uv.lock
15+
.DS_Store
16+
uv.lock
1717

18-
*.envrc
18+
.envrc

aoc/models/file.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def add_day(year: int, day: int) -> None:
114114
sample_file = path / "templates/solutions/sample.py"
115115
content = sample_file.read_text()
116116

117+
solution_path.parent.mkdir(parents=True, exist_ok=True)
117118
solution_path.write_text(content)
118119
logger.info(f"Created file: {solution_path}")
119120

@@ -229,5 +230,6 @@ def add_test_file(year: int, day: int) -> None:
229230
content = sample_file.read_text().format(year=year, day=day)
230231

231232
# Write the formatted content
233+
test_path.parent.mkdir(parents=True, exist_ok=True)
232234
test_path.write_text(content)
233235
logger.info(f"Created file: {test_path}")

0 commit comments

Comments
 (0)