From 069b4842fb675e69cde3ff4d138ac5fac5d4c19ce3b42d4b219a84ba977a8358 Mon Sep 17 00:00:00 2001 From: Vladimir Bobrov Date: Thu, 27 Nov 2025 17:37:52 +0300 Subject: [PATCH] Do not mkdir blindly during set and add --- dsc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dsc b/dsc index 9a7edad..78680ee 100755 --- a/dsc +++ b/dsc @@ -128,6 +128,19 @@ proc txtar-fn {line} { return "" } +proc assure-all-list-params-exist {opt {offset 0}} { + global Stash + set pth [find-opt-schema $opt] + set idx [lindex [lsearch -all [file split $pth] "*"] end-$offset] + if {$idx != ""} { + set pth [file join {*}[lrange [file split $opt] 0 $idx]] + if {! [file exists $Stash/$pth]} { + puts stderr "$pth does not exist" + exit 1 + } + } +} + set opt [lindex $argv 1] switch [lindex $argv 0] { list { @@ -159,6 +172,7 @@ switch [lindex $argv 0] { } } add { + assure-all-list-params-exist $opt 1 set dir [file dirname $opt] set tail [run-checker $opt [file tail $opt]] set tail [string trimright $tail "\n"] @@ -172,6 +186,7 @@ switch [lindex $argv 0] { file delete -force $Stash/$opt } set { + assure-all-list-params-exist $opt if {[llength $argv] > 2} { set v [lindex $argv 2] if {$v == ""} { -- 2.52.0