Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: create directory if path is passed #1869

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## 📚 Documentation -->

# [0.23.1] (unreleased) - 2024-mm-dd

## 🐛 Fixes

- **Create missing intermediary directories - @WolffRuoff #1798**

Previously, when using `--output` with a nonexistent directory, some operating systems would say they wrote the file but not actually write anything. Now, Rover will consistently create any missing directories passed to `--output`.


# [0.23.0] - 2024-03-26

## 🚀 Features
Expand Down
5 changes: 5 additions & 0 deletions crates/rover-std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ impl Fs {
&path
)
})?;

if let Some(p) = path.parent() {
Self::create_dir_all(p)?;
};

if !path.exists() {
File::create(path)
.with_context(|| format!("{} does not exist and it could not be created", &path))?;
Expand Down