Добавлена проверка параметров вызова файл или просто строка
This commit is contained in:
parent
e7c1cbbbe1
commit
5c605d6907
19
tkregexp.tcl
19
tkregexp.tcl
|
@ -1084,14 +1084,16 @@ if {$argc > 1} {
|
||||||
puts "Usage: $argv0 <sampleFile>"
|
puts "Usage: $argv0 <sampleFile>"
|
||||||
} elseif {$argc == 1} {
|
} elseif {$argc == 1} {
|
||||||
set filename [lindex $argv 0]
|
set filename [lindex $argv 0]
|
||||||
set file [open $filename]
|
if [file exists $filename] {
|
||||||
set data [read $file [file size $filename]]
|
set file [open $filename]
|
||||||
close $file
|
set data [read $file [file size $filename]]
|
||||||
|
close $file
|
||||||
# memorize location
|
# memorize location
|
||||||
set regexp::data(v:dir) [file dirname $filename]
|
set regexp::data(v:dir) [file dirname $filename]
|
||||||
set regexp::data(v:file) [file tail $filename]
|
set regexp::data(v:file) [file tail $filename]
|
||||||
|
} else {
|
||||||
|
set data [lindex $argv 0]
|
||||||
|
}
|
||||||
regexp::sample:set $data
|
regexp::sample:set $data
|
||||||
unset data
|
unset data
|
||||||
}
|
}
|
||||||
|
@ -1366,4 +1368,3 @@ proc make-regexp::make-regexp {words} {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user