From dd71d533cea89097878533bfd9fdec3e0f121aad Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 14 Aug 2023 12:18:54 +0200 Subject: [PATCH] make_symbol: ask before overwriting an existing symbol file. --- src/xschem.tcl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 49c1efcc..57229bed 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3222,9 +3222,16 @@ proc add_lab_prefix {} { xschem merge $USER_CONF_DIR/.clipboard.sch } -proc make_symbol {name} { +proc make_symbol {name {ask {no}} } { global XSCHEM_SHAREDIR symbol_width set name [abs_sym_path $name ] + set symname [abs_sym_path $name .sym] + if { $ask eq {no} && [file exists $symname] } { + set answer [tk_messageBox -message "Warning: symbol $symname already exists. Overwrite?" \ + -icon warning -parent [xschem get topwindow] -type okcancel] + if {$answer ne {ok}} { return {}} + + } # puts "make_symbol{}, executing: ${XSCHEM_SHAREDIR}/make_sym.awk $symbol_width ${name}" eval exec {awk -f ${XSCHEM_SHAREDIR}/make_sym.awk $symbol_width $name} return {}