Skip to content

Fix: create parent directories recursively in check_output_dir#57

Open
fuleinist wants to merge 1 commit intodanihek:mainfrom
fuleinist:main
Open

Fix: create parent directories recursively in check_output_dir#57
fuleinist wants to merge 1 commit intodanihek:mainfrom
fuleinist:main

Conversation

@fuleinist
Copy link
Copy Markdown

Problem

When running hellwal for the first time (or after clearing cache), it fails to write cache files because the parent directories (~/.cache/hellwal/cache/) don't exist yet. The previous implementation only called mkdir() on the final path component, which fails if parent directories are missing.

Solution

Modify check_output_dir to recursively create all parent directories before creating the final directory. This mimics mkdir -p behavior.

Use case

Users running hellwal for the first time will no longer see Cannot write to file and Cannot access directory warnings — the required directories are created automatically.

Testing

  • Compiled successfully with make (no warnings)
  • Logic: iterates through path components, creating each directory before the next, similar to how mkdir -p works

Fixes issue where hellwal fails to write cache files if parent
directories (~/.cache/hellwal/) don't exist yet. The previous
implementation only called mkdir() on the final path component,
which fails if parent directories are missing.
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.

1 participant