Skip to content

Commit

Permalink
Ensure data dir exists immediately after reading settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Dec 31, 2024
1 parent 805d31f commit 43f12b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# History

## Unreleased
* Fix issue with first-time installation on Windows

## 0.8.0 (2024-10-10)
**UI:**
* Add tab for browsing user's observations
Expand Down
3 changes: 2 additions & 1 deletion naturtag/storage/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def start_image_dir(self) -> Path:
def read(cls, path: Path = CONFIG_PATH) -> 'Settings':
"""Read settings from config file"""
# New file; no contents to read
if not path or not path.is_file():
if not path.is_file():
path.parent.mkdir(parents=True, exist_ok=True)
return cls(path=path)

logger.debug(f'Reading settings from {path}')
Expand Down
4 changes: 3 additions & 1 deletion naturtag/widgets/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@


def init_handler(
level: str = 'DEBUG', root_level: str = 'INFO', logfile: PathOrStr = 'log.log'
level: str = 'DEBUG',
root_level: str = 'INFO',
logfile: PathOrStr = 'naturtag.log',
) -> 'QtRichHandler':
"""Initialize logging handler and attach to root logger
Expand Down

0 comments on commit 43f12b8

Please sign in to comment.