1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
--- src/app-wavesurfer/wavesurfer__orig.tcl 2018-09-08 19:58:23.463734379 +0200
+++ src/app-wavesurfer/wavesurfer.tcl 2018-09-08 20:19:48.386838554 +0200
@@ -461,6 +461,20 @@
}
}
+proc getConfigPath {name} {
+ set l [::wsurf::GetConfigurations]
+ # quote regexp sensible characters
+ set config [string map {+ \\+} $name]
+ set ind [lsearch -regexp $l ".*${config}\[\\w\\s\]*.conf"]
+ if {$ind != -1} {
+ set conf [lindex $l $ind]
+ } else {
+ set conf ""
+ }
+ return $conf
+}
+
+
proc OpenFile {args} {
puts [info level 0]
@@ -507,13 +521,7 @@
::SavePreferences
}
} else {
- set l [::wsurf::GetConfigurations]
- set ind [lsearch -regexp $l ".*$::wsurf::Info(Prefs,defaultConfig)\[\\w\\s\]*.conf"]
- if {$ind != -1} {
- set conf [lindex $l $ind]
- } else {
- set conf ""
- }
+ set conf [getConfigPath $::wsurf::Info(Prefs,defaultConfig)]
}
if {$conf == "standard"} {
set conf ""
@@ -907,13 +915,7 @@
::SavePreferences
}
} else {
- set l [::wsurf::GetConfigurations]
- set ind [lsearch -regexp $l ".*$::wsurf::Info(Prefs,defaultConfig)\[\\w\\s\]*.conf"]
- if {$ind != -1} {
- set conf [lindex $l $ind]
- } else {
- set conf ""
- }
+ set conf [getConfigPath $::wsurf::Info(Prefs,defaultConfig)]
}
if {$conf == ""} return
if {$conf == "standard"} {
@@ -3439,11 +3441,10 @@
update idletasks
if {$surf(conf) == "unspecified" && $::wsurf::Info(Prefs,defaultConfig) != ""} {
- set l [::wsurf::GetConfigurations]
- set ind [lsearch -regexp $l ".*$::wsurf::Info(Prefs,defaultConfig)\[\\w\\s\]*.conf"]
- if {$ind != -1} {
+ set conf [getConfigPath $::wsurf::Info(Prefs,defaultConfig)]
+ if {$conf ne ""} {
set surf(conf) {}
- lappend surf(conf) [lindex $l $ind]
+ lappend surf(conf) $conf
} else {
set surf(conf) [list "unspecified"]
}
|