Fix: create parent directories recursively in check_output_dir#57
Open
fuleinist wants to merge 1 commit intodanihek:mainfrom
Open
Fix: create parent directories recursively in check_output_dir#57fuleinist wants to merge 1 commit intodanihek:mainfrom
fuleinist wants to merge 1 commit intodanihek:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_dirto recursively create all parent directories before creating the final directory. This mimicsmkdir -pbehavior.Use case
Users running hellwal for the first time will no longer see
Cannot write to fileandCannot access directorywarnings — the required directories are created automatically.Testing
make(no warnings)mkdir -pworks