From 66c2870eb018ecc66d191a415ef676630b72755f Mon Sep 17 00:00:00 2001 From: Omnikar Date: Fri, 18 Mar 2022 13:39:44 -0400 Subject: [PATCH] Make `:write` create nonexistant subdirectories Prompting as to whether this should take place remains a TODO. --- helix-view/src/document.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 671ceb75f84ff..dab2f1ff8ac72 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -471,7 +471,7 @@ impl Document { if let Some(parent) = path.parent() { // TODO: display a prompt asking the user if the directories should be created if !parent.exists() { - bail!("can't save file, parent directory does not exist"); + std::fs::DirBuilder::new().recursive(true).create(parent)?; } }