Skip to content

Check the path exists better#33

Merged
whitead merged 1 commit into
mainfrom
exists
Aug 16, 2025
Merged

Check the path exists better#33
whitead merged 1 commit into
mainfrom
exists

Conversation

@whitead

@whitead whitead commented Aug 16, 2025

Copy link
Copy Markdown
Owner

Fixes #30

@whitead whitead requested a review from Copilot August 16, 2025 23:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves directory creation logic by using the exist_ok=True parameter in os.makedirs() instead of manually checking if the directory exists first. This simplifies the code and makes it more robust against race conditions.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread molbloom/__init__.py
filter_path = os.path.join(_DEFAULT_PATH, f"{name}.bloom")
if not os.path.exists(_DEFAULT_PATH):
os.makedirs(_DEFAULT_PATH)
os.makedirs(_DEFAULT_PATH, exist_ok=True)

Copilot AI Aug 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes a potential race condition where the directory could be created by another process between the existence check and the makedirs call. The exist_ok=True parameter is the correct approach.

Copilot uses AI. Check for mistakes.
@whitead whitead requested a review from Jgmedina95 August 16, 2025 23:43
@whitead whitead merged commit 6c1d5df into main Aug 16, 2025
3 checks passed
@whitead whitead deleted the exists branch August 16, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: File exists: '/home/runner/.cache/molbloom'

3 participants