mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 05:27:47 +02:00
Create config directory if necessary
This commit is contained in:
parent
8e84bf0446
commit
cc5240eeec
1 changed files with 8 additions and 0 deletions
|
@ -186,6 +186,14 @@ impl Settings {
|
||||||
|
|
||||||
let exists = filename.exists();
|
let exists = filename.exists();
|
||||||
|
|
||||||
|
// try to create the parent directory if the file does not exist
|
||||||
|
if !exists {
|
||||||
|
if let Some(dir) = filename.parent() {
|
||||||
|
fs::create_dir_all(dir)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// start with the existing document, or a blank document
|
||||||
let mut document = if exists {
|
let mut document = if exists {
|
||||||
fs::read_to_string(filename.clone())
|
fs::read_to_string(filename.clone())
|
||||||
.context("Could not read existing configuration file")?
|
.context("Could not read existing configuration file")?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue