Artifact
7ffd6039095e0ef28c72aadbc1a9fd362c9223c1:
Attachment "patch" to
ticket [e21fc32c2a]
added by
danckaert
2016-03-08 14:36:53.
(unpublished)
0000: 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 6c 69 62 diff --git a/lib
0010: 72 61 72 79 2f 69 6e 69 74 2e 74 63 6c 20 62 2f rary/init.tcl b/
0020: 6c 69 62 72 61 72 79 2f 69 6e 69 74 2e 74 63 6c library/init.tcl
0030: 0a 69 6e 64 65 78 20 38 35 39 30 30 64 32 2e 2e .index 85900d2..
0040: 63 64 35 37 35 31 66 20 31 30 30 36 34 34 0a 2d cd5751f 100644.-
0050: 2d 2d 20 61 2f 6c 69 62 72 61 72 79 2f 69 6e 69 -- a/library/ini
0060: 74 2e 74 63 6c 0a 2b 2b 2b 20 62 2f 6c 69 62 72 t.tcl.+++ b/libr
0070: 61 72 79 2f 69 6e 69 74 2e 74 63 6c 0a 40 40 20 ary/init.tcl.@@
0080: 2d 36 35 30 2c 37 20 2b 36 35 30 2c 37 20 40 40 -650,7 +650,7 @@
0090: 20 70 72 6f 63 20 61 75 74 6f 5f 65 78 65 63 6f proc auto_execo
00a0: 6b 20 6e 61 6d 65 20 7b 0a 20 09 23 20 65 78 65 k name {. .# exe
00b0: 63 20 69 74 20 75 6e 6c 65 73 73 20 74 68 65 20 c it unless the
00c0: 63 61 73 65 20 69 73 20 72 69 67 68 74 2c 20 77 case is right, w
00d0: 68 69 63 68 20 74 68 69 73 20 63 6f 72 72 65 63 hich this correc
00e0: 74 73 2e 20 20 43 4f 4d 53 50 45 43 0a 20 09 23 ts. COMSPEC. .#
00f0: 20 6d 61 79 20 6e 6f 74 20 70 6f 69 6e 74 20 74 may not point t
0100: 6f 20 61 20 72 65 61 6c 20 66 69 6c 65 2c 20 73 o a real file, s
0110: 6f 20 64 6f 20 74 68 65 20 63 68 65 63 6b 2e 0a o do the check..
0120: 20 09 73 65 74 20 63 6d 64 20 24 65 6e 76 28 43 .set cmd $env(C
0130: 4f 4d 53 50 45 43 29 0a 2d 09 69 66 20 7b 5b 66 OMSPEC).-.if {[f
0140: 69 6c 65 20 65 78 69 73 74 73 20 24 63 6d 64 5d ile exists $cmd]
0150: 7d 20 7b 0a 2b 09 69 66 20 7b 5b 66 69 6c 65 20 } {.+.if {[file
0160: 65 78 65 63 75 74 61 62 6c 65 20 24 63 6d 64 5d executable $cmd]
0170: 7d 20 7b 0a 20 09 20 20 20 20 73 65 74 20 63 6d } {. . set cm
0180: 64 20 5b 66 69 6c 65 20 61 74 74 72 69 62 75 74 d [file attribut
0190: 65 73 20 24 63 6d 64 20 2d 73 68 6f 72 74 6e 61 es $cmd -shortna
01a0: 6d 65 5d 0a 20 09 7d 0a 20 09 72 65 74 75 72 6e me]. .}. .return
01b0: 20 5b 73 65 74 20 61 75 74 6f 5f 65 78 65 63 73 [set auto_execs
01c0: 28 24 6e 61 6d 65 29 20 5b 6c 69 73 74 20 24 63 ($name) [list $c
01d0: 6d 64 20 2f 63 20 24 6e 61 6d 65 5d 5d 0a 40 40 md /c $name]].@@
01e0: 20 2d 36 35 39 2c 37 20 2b 36 35 39 2c 37 20 40 -659,7 +659,7 @
01f0: 40 20 70 72 6f 63 20 61 75 74 6f 5f 65 78 65 63 @ proc auto_exec
0200: 6f 6b 20 6e 61 6d 65 20 7b 0a 20 20 20 20 20 69 ok name {. i
0210: 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 66 69 6c f {[llength [fil
0220: 65 20 73 70 6c 69 74 20 24 6e 61 6d 65 5d 5d 20 e split $name]]
0230: 21 3d 20 31 7d 20 7b 0a 20 09 66 6f 72 65 61 63 != 1} {. .foreac
0240: 68 20 65 78 74 20 24 65 78 65 63 45 78 74 65 6e h ext $execExten
0250: 73 69 6f 6e 73 20 7b 0a 20 09 20 20 20 20 73 65 sions {. . se
0260: 74 20 66 69 6c 65 20 24 7b 6e 61 6d 65 7d 24 7b t file ${name}${
0270: 65 78 74 7d 0a 2d 09 20 20 20 20 69 66 20 7b 5b ext}.-. if {[
0280: 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c file exists $fil
0290: 65 5d 20 26 26 20 21 5b 66 69 6c 65 20 69 73 64 e] && ![file isd
02a0: 69 72 65 63 74 6f 72 79 20 24 66 69 6c 65 5d 7d irectory $file]}
02b0: 20 7b 0a 2b 09 20 20 20 20 69 66 20 7b 5b 66 69 {.+. if {[fi
02c0: 6c 65 20 65 78 65 63 75 74 61 62 6c 65 20 24 66 le executable $f
02d0: 69 6c 65 5d 20 26 26 20 21 5b 66 69 6c 65 20 69 ile] && ![file i
02e0: 73 64 69 72 65 63 74 6f 72 79 20 24 66 69 6c 65 sdirectory $file
02f0: 5d 7d 20 7b 0a 20 09 09 72 65 74 75 72 6e 20 5b ]} {. ..return [
0300: 73 65 74 20 61 75 74 6f 5f 65 78 65 63 73 28 24 set auto_execs($
0310: 6e 61 6d 65 29 20 5b 6c 69 73 74 20 24 66 69 6c name) [list $fil
0320: 65 5d 5d 0a 20 09 20 20 20 20 7d 0a 20 09 7d 0a e]]. . }. .}.
0330: 40 40 20 2d 36 39 32 2c 37 20 2b 36 39 32 2c 37 @@ -692,7 +692,7
0340: 20 40 40 20 70 72 6f 63 20 61 75 74 6f 5f 65 78 @@ proc auto_ex
0350: 65 63 6f 6b 20 6e 61 6d 65 20 7b 0a 20 09 20 20 ecok name {. .
0360: 20 20 7d 0a 20 09 20 20 20 20 73 65 74 20 63 68 }. . set ch
0370: 65 63 6b 65 64 28 24 64 69 72 29 20 7b 7d 0a 20 ecked($dir) {}.
0380: 09 20 20 20 20 73 65 74 20 66 69 6c 65 20 5b 66 . set file [f
0390: 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 20 24 7b ile join $dir ${
03a0: 6e 61 6d 65 7d 24 7b 65 78 74 7d 5d 0a 2d 09 20 name}${ext}].-.
03b0: 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 if {[file exi
03c0: 73 74 73 20 24 66 69 6c 65 5d 20 26 26 20 21 5b sts $file] && ![
03d0: 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 file isdirectory
03e0: 20 24 66 69 6c 65 5d 7d 20 7b 0a 2b 09 20 20 20 $file]} {.+.
03f0: 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 65 63 75 if {[file execu
0400: 74 61 62 6c 65 20 24 66 69 6c 65 5d 20 26 26 20 table $file] &&
0410: 21 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f ![file isdirecto
0420: 72 79 20 24 66 69 6c 65 5d 7d 20 7b 0a 20 09 09 ry $file]} {. ..
0430: 72 65 74 75 72 6e 20 5b 73 65 74 20 61 75 74 6f return [set auto
0440: 5f 65 78 65 63 73 28 24 6e 61 6d 65 29 20 5b 6c _execs($name) [l
0450: 69 73 74 20 24 66 69 6c 65 5d 5d 0a 20 09 20 20 ist $file]]. .
0460: 20 20 7d 0a 20 09 7d 0a }. .}.