From 729b51d67421703f4a5cb2dbf25c9454ae56a73d Mon Sep 17 00:00:00 2001 From: Arijit Basu Date: Mon, 10 Jan 2022 15:47:04 +0530 Subject: [PATCH] Create parent directories before creating the file --- src/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/init.lua b/src/init.lua index a7eb623..3549166 100644 --- a/src/init.lua +++ b/src/init.lua @@ -1269,8 +1269,9 @@ xplr.config.modes.builtin.create_file = { { BashExecSilently = [===[ PTH="$XPLR_INPUT_BUFFER" - if [ "${PTH}" ]; then - touch -- "${PTH:?}" \ + if [ "$PTH" ]; then + mkdir -p -- "$(dirname $PTH)" \ + && touch -- "$PTH" \ && echo "SetInputBuffer: ''" >> "${XPLR_PIPE_MSG_IN:?}" \ && echo LogSuccess: $PTH created >> "${XPLR_PIPE_MSG_IN:?}" \ && echo ExplorePwd >> "${XPLR_PIPE_MSG_IN:?}" \