Stub for the ACM_METRIC_MAX_SIZE_FORMAT command of acmMetrics.
[wine] / tools / wineconf.libs / autoconf.tcl
1 proc TkW:autoconf {outfile} {
2
3 # This files scans the fstab, then creates a wine.conf file
4 # parsed to wineconf for further editings....
5
6 # MS DOS drives are sorted following the rules explained in tools/wineconf
7
8         global PATH
9         global TMPLetter WINLetter SYSLetter
10
11         global OUTF
12         set OUTF [open $outfile w]
13
14         TkW:InitNewConfig
15         set err [TkW:readFStab]
16
17         TkW:SortDosDrives
18         TkW:addRootDrives
19         
20         set TMP [TkW:SearchTmp]
21         TkW:ShowDrives
22
23
24         set Windows [TkW:FindWindows]
25         set System "$Windows/system"
26         set Windows [TkW:Unix2Dos $Windows]
27         set System [TkW:Unix2Dos $System]
28         TkW:MiscEndConf $TMP 
29         puts $OUTF "\[Wine\]\nwindows=$Windows"
30         puts $OUTF "system=$System"
31         puts $OUTF "Temp=[TkW:Unix2Dos $TMP]"
32         puts $OUTF "Path= $Windows\;$System\;$PATH"
33
34         #Quick and dirty... I'm tired now!
35         #puts $OUTF "SymbolTableFile=[exec find / -name wine.sym -print]"
36         puts $OUTF "printer=on"
37         puts $OUTF ""
38
39         puts $OUTF "\[DllDefaults\]"
40         puts $OUTF "\;EXTRA_LD_LIBRARY_PATH=\$\{HOME\}/wine/cvs/lib"
41         puts $OUTF ""
42         puts $OUTF "\[DllPairs\]"
43         puts $OUTF "kernel  = kernel32"
44         puts $OUTF "gdi     = gdi32"
45         puts $OUTF "user    = user32"
46         puts $OUTF "commdlg = comdlg32"
47         puts $OUTF "commctrl= comctl32"
48         puts $OUTF "ver     = version"
49         puts $OUTF "shell   = shell32"
50         puts $OUTF "lzexpand= lz32"
51         puts $OUTF "mmsystem= winmm"
52         puts $OUTF "msvideo = msvfw32"
53         puts $OUTF "winsock = wsock32"
54         puts $OUTF ""
55
56          puts $OUTF "\[DllOverrides\]"
57         puts $OUTF "kernel32, gdi32, user32 = builtin"
58         puts $OUTF "kernel, gdi, user       = builtin"
59         puts $OUTF "toolhelp                = builtin"
60         puts $OUTF "comdlg32, commdlg       = elfdll, builtin, native"
61         puts $OUTF "version, ver            = elfdll, builtin, native"
62         puts $OUTF "shell32, shell          = builtin, native"
63         puts $OUTF "lz32, lzexpand          = builtin, native"
64         puts $OUTF "commctrl, comctl32      = builtin, native"
65         puts $OUTF "sock32, winsock        = builtin"
66         puts $OUTF "advapi32, crtdll, ntdll = builtin, native"
67         puts $OUTF "mpr, winspool           = builtin, native"
68         puts $OUTF "ddraw, dinput, dsound   = builtin, native"
69         puts $OUTF "winmm, mmsystem         = builtin"
70         puts $OUTF "msvideo, msvfw32        = builtin, native"
71         puts $OUTF "w32skrnl                = builtin"
72         puts $OUTF "wnaspi32, wow32         = builtin"
73         puts $OUTF "system, display, wprocs = builtin"
74         puts $OUTF "wineps                  = builtin"
75         puts $OUTF ""
76
77         puts $OUTF "\[options\]"
78         puts $OUTF "AllocSystemColors=100"
79         puts $OUTF ""
80
81         puts $OUTF "\[fonts\]"
82         puts $OUTF "Resolution = 96 "
83         puts $OUTF "Default = -adobe-times-"
84         puts $OUTF ""
85
86         puts $OUTF "\[serialports\]"
87         puts $OUTF "Com1=/dev/ttyS0"
88         puts $OUTF "Com2=/dev/ttyS1"
89         puts $OUTF "Com3=/dev/modem,38400"
90         puts $OUTF "Com4=/dev/modem"
91         puts $OUTF ""
92
93         puts $OUTF "\[parallelports\]"
94         puts $OUTF "Lpt1=/dev/lp0"
95         puts $OUTF ""
96
97         puts $OUTF "\[spooler\]"
98         puts $OUTF "LPT1:=|lpr"
99         puts $OUTF "LPT2:=|gs -sDEVICE=bj200 -sOutputFile=/tmp/fred -q -"
100         puts $OUTF "LPT3:=/dev/lp3"
101         puts $OUTF ""
102
103         puts $OUTF "\[ports\]"
104         puts $OUTF "\;read=0x779,0x379,0x280-0x2a0"
105         puts $OUTF "\;write=0x779,0x379,0x280-0x2a0"
106         puts $OUTF ""
107
108          puts $OUTF "\[spy\]"
109         puts $OUTF "Exclude=WM_SIZE" 
110         puts $OUTF ";WM_TIMER"
111         puts $OUTF ""
112         
113         puts $OUTF "\[Tweak.Layout\]"
114         puts $OUTF ";WineLook=xxx       (supported styles are \'Win31\'(default),"
115         puts $OUTF ";\'Win95\', \'Win98\')"
116         puts $OUTF "WineLook=Win31"
117         puts $OUTF ""
118
119         puts $OUTF "\[programs\]"
120         puts $OUTF "Default=]"
121         puts $OUTF "Startup="
122
123         close $OUTF
124 }
125
126 proc TkW:readFStab {} {
127
128         global AlternateFstab OK CANCEL
129
130         if {![file exist /etc/fstab]} {
131                 TkW:GetFileName $AlternateFstab $OK $CANCEL File
132                 TkW:FStabError 1
133                 return 1
134         } else {
135                 set FSTAB "/etc/fstab"
136         }
137         if {![file readable $FSTAB]} {TkW:FStabError 2;return 1}
138
139         set FStab [open /etc/fstab]
140         while {![eof $FStab]} {
141
142                 gets $FStab line
143                 set line [string trim $line]
144                 if {[string range $line 0 0] != "#" && $line != ""} {
145                         #we have an entry
146                         switch [lindex $line 2] {
147
148                                 swap {}
149                                 proc {}
150                                 minix {TkW:addUnixDrive $line}
151                                 ext2 {TkW:addUnixDrive $line}
152                                 xiafs {TkW:addUnixDrive $line}
153                                 vfat {TkW:addDosDrive $line}
154                                 msdos {TkW:addDosDrive msdos}
155                                 hpfs {TkW:addDosDrive $line}
156                                 iso9660 {TkW:addCdRomDrive $line}
157                                 nfs {TkW:addNetDrive $line}
158                                 auto {TkW:addAutoDrive $line}
159                                 default {TkW:unknownDeviceType $line}
160                                 
161                         }
162                 }
163         }
164 }
165
166 proc TkW:addRootDrives {} {
167
168         global RootDrives1 RootDrives2 OK CANCEL WAIT lineroot ADD REMOVE
169         global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
170         global exclude  All
171         
172         set drivelist ""
173         set drivelist "$drivelist [glob -nocomplain /*]"
174         set List ""
175         set excludes "$exclude /boot /lost+found /lib /etc /var /sbin /initrd\
176                         /cdrom /floppy /include /man /dev /proc /bin /mnt /tmp"
177         set n 0
178         foreach i $drivelist {
179                 if {[file isdir $i]} {
180                         set skip 0
181                         
182                         foreach k $excludes {
183                                 if {$k  == $i} {
184                                         set skip 1
185                                 }
186                         }
187                          if {$skip == 0} {set List "$List$i "}
188                 }
189         }
190         set List [lsort $List]
191         set n 0
192         foreach i $List {
193                 set All($n) $i;set n [expr $n + 1]
194         }
195         set dev  [lindex $lineroot 0]
196         toplevel .rootDr -background #ffffff 
197         wm title .rootDr  "Wine Autoconfigurator"
198         label .rootDr.banner -backgr #0000ff -foregr #ffffff \
199                 -text "$RootDrives1$dev $RootDrives2" \
200                 -wraplength 300
201         pack .rootDr.banner -fill x
202         frame .rootDr.lists -backgr #ffffff
203         pack .rootDr.lists -padx 10 -pady 10
204         listbox .rootDr.lists.left -width 20 -height 10 
205         pack .rootDr.lists.left -padx 10 -pady 0  -side left
206
207         frame .rootDr.lists.buttons -backgr #ffffff
208         pack .rootDr.lists.buttons -padx 10 -pady 0  -side left
209
210         button .rootDr.lists.buttons.add -text "$ADD >>" -width 8\
211                 -command {TkW:AddRootDrInList [.rootDr.lists.left cursel]}
212         pack .rootDr.lists.buttons.add -padx 10 -pady 0  -side top
213
214         button .rootDr.lists.buttons.space -text "" -backgr #ffffff \
215                 -border 0 -highlightb  #ffffff -relief flat -width 8 -state disabled
216         pack .rootDr.lists.buttons.space -padx 10 -pady 0  -side top
217
218         button .rootDr.lists.buttons.rem -text "<< $REMOVE" -width 8\
219                 -command {TkW:RemRootDrInList [.rootDr.lists.right cursel]}
220         pack .rootDr.lists.buttons.rem -padx 10 -pady 0  -side top
221
222         listbox .rootDr.lists.right -width 20 -height 10 
223         pack .rootDr.lists.right -padx 10 -pady 0 
224
225         frame .rootDr.cmd -background #ffffff
226         pack .rootDr.cmd -side bottom -anchor c -pady 5
227         
228         button .rootDr.cmd.ok -text OK -width 8 \
229                 -command {destroy .rootDr;set WAIT 0}
230         pack .rootDr.cmd.ok -side left
231
232         foreach i $List {
233                 .rootDr.lists.left insert end $i
234         }
235
236         global ToAddList;set ToAddList ""
237
238         bind .rootDr.lists.left <Double-ButtonPress-1> {
239                 TkW:AddRootDrInList [.rootDr.lists.left nearest %y]}
240         bind .rootDr.lists.right <Double-ButtonPress-1> {
241                 TkW:RemRootDrInList [.rootDr.lists.right nearest %y]}
242         set WAIT wait
243         while {$WAIT == "wait" } {update}
244         foreach i $ToAddList {
245                 set NunixDrives [expr $NunixDrives + 1]
246                 set UnixPath($NunixDrives) $i
247                 set exclude "$exclude$UnixPath($NunixDrives) "
248                 set UnixLabel($NunixDrives) $i
249                 set UnixType($NunixDrives) hd
250                 set UnixFS($NunixDrives) win95
251         }
252 }
253
254 proc TkW:AddRootDrInList {N} {
255
256         global All ToAddList Nadd Add
257         if {![info exists All($N)]} {return}
258         foreach i $ToAddList {
259                 if {$i == $All($N)} {return}
260         }
261         set  ToAddList [lsort "$ToAddList $All($N)"]
262         .rootDr.lists.right delete 0 end
263         set Nadd 0
264         foreach i $ToAddList {
265                 .rootDr.lists.right insert end $i
266                 set Add($Nadd) $i
267                 set Nadd [expr $Nadd + 1]
268         }
269 }
270 proc TkW:RemRootDrInList {N} {
271         global All ToAddList Nadd Add
272         if {![info exists Add($N)]} {return}
273         set NewList ""
274         foreach i $ToAddList {
275                 if {$i != $Add($N)} {set NewList "$NewList$i "}
276         }
277         set ToAddList $NewList
278         set Nadd 0
279         .rootDr.lists.right delete 0 end
280         foreach i $ToAddList {
281                 .rootDr.lists.right insert end $i
282                 set Add($Nadd) $i
283                 set Nadd [expr $Nadd + 1]
284         }
285 }
286 proc TkW:addUnixDrive {line} {
287         global lineroot
288         #pre-processing for the case of the root:
289         if {![file exists [lindex $line 1]]} {return}
290         if {[lindex $line 1] != "/"} { TkW:addUnixDriveOK $line}  {set lineroot $line}
291 }
292 proc TkW:addUnixDriveOK {line} {
293
294         # for now, I'll consider any unix file as ext2... 
295         # may be this should improve a bit!
296
297         global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
298         
299         global TMPDRIVE HOMEDRIVE exclude
300
301         set NunixDrives [expr $NunixDrives +1]
302
303         set UnixDevice($NunixDrives) [lindex $line 0]
304         set UnixType($NunixDrives) "hd"
305         set UnixPath($NunixDrives)  [lindex $line 1] 
306         set exclude "$exclude$UnixPath($NunixDrives) "
307         set  UnixLabel($NunixDrives) "UNIX $NunixDrives"
308         if {[string first "/tmp" $UnixPath($NunixDrives)] > 0 && $TMPDRIVE == 0} {
309                 set  UnixLabel($NunixDrives) "TEMP"
310         }
311         if {[string first "/home" $UnixDevice($NunixDrives)] > 0 && $HOMEDRIVE == 0} {
312                 set  UnixLabel($NunixDrives) "HOME"
313         }
314         set UnixDevice($NunixDrives) ""
315         set UnixSerial($NunixDrives) ""
316         set UnixFS($NunixDrives) "win95"
317         set UnixType($NunixDrives) "hd"
318 }
319 proc TkW:addDosDrive {line} {
320
321         # for now, I'll consider any dos file as ext2... 
322         # may be this should improve a bit!
323
324         global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS
325         
326         global TMPDRIVE HOMEDRIVE exclude
327
328         if {![file exists [lindex $line 1]]} {return}
329
330         if { [string first "/dev/fd" [lindex $line 0]] == 0  } {
331                 TkW:addFloppy $line
332                 return
333         }
334
335         set NdosDrives [expr $NdosDrives +1]
336
337         set DosDevice($NdosDrives) [lindex $line 0]
338         set DosPath($NdosDrives)  [lindex $line 1] 
339         set exclude "$exclude$DosPath($NdosDrives) "
340         set  DosLabel($NdosDrives) ""
341         set DosType($NdosDrives) "win95"
342         if {[lindex $line 2] == "msods"} {
343                 set DosFS($NdosDrives) 
344         } else {
345                 set DosFS($NdosDrives) "win95"
346         }
347         set DosSerial($NdosDrives) ""
348 }
349
350 proc TkW:unknownDeviceType {line} {
351
352         TkW:message "Error\n\
353 [lindex $line 0] (mounted on [lindex $line 1]) : Unknown device type. Please, mail thirot@univ-brest.fr for me to add this filesystem to the list of detected FS.\n\
354 \n              Thank you.\
355 \n                      Jean-Louis Thirot"
356         global WAIT
357         set WAIT wait
358         while {$WAIT == "wait"} {update}
359
360 }
361
362 proc TkW:InitNewConfig {} {
363         
364         global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
365         global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS
366         global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
367         global Nfloppys FLOPPYPath FLOPPYDevice FLOPPYLabel FLOPPYType FLOPPYSerial FLOPPYFS
368         global NnetDrives
369         global TMPDRIVE HOMEDRIVE
370         global exclude; set exclude ""
371
372         set TMPDRIVE 0
373         set HOMEDRIVE 0
374
375         set NunixDrives 0
376         set NdosDrives 0
377         set Ncdroms 0
378         set Nfloppys 0
379         set NnetDrives 0
380 }
381
382 proc TkW:ShowDrives {} {
383
384         global NunixDrives UnixPath UnixDevice UnixLabel UnixType UnixSerial UnixFS
385         global NdosDrives DosPath DosDevice DosLabel DosType DosSerial DosFS       
386         global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
387         global NnetDrives NetPath NetLabel 
388         global Nfloppys FLOPPYPath
389         global DriveRank DRIVEUNIXPATH DRIVEDOSPATH NDRIVES
390         global OUTF
391         
392         set NDRIVES 0
393         set letters {let: C D E F G H I J K L M N O P Q R S T U V W X Y Z}
394         set lettersF {let: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
395         for  {set i 1} {$i <= $NdosDrives} {set i [expr $i + 1]} {
396                 set NDRIVES [expr $NDRIVES + 1]
397                 set rank $DriveRank($i)
398                 puts $OUTF "\[Drive [lindex $letters $i]\]"
399                 set Letter($NDRIVES)  [lindex $letters $i]
400                 set DRIVEUNIXPATH($NDRIVES) $DosPath($rank)
401                 set DRIVEDOSPATH($NDRIVES) "[lindex $letters $i]:\\"
402                 puts $OUTF "Path=$DosPath($rank)"
403                 puts $OUTF "Type=hd"
404                 puts $OUTF "Label=MS-DOS $rank"
405                 puts $OUTF "Filesystem=$DosFS($rank)"
406                 puts $OUTF ""
407         }
408         for  {set i 1} {$i <= $Nfloppys} {set i [expr $i + 1]} {
409                 if {$i > 2} {
410                         set NDRIVES [expr $NDRIVES + 1]
411                         set NLet $NDRIVES
412                         set DRIVEDOSPATH($NDRIVES) "[lindex $lettersF $NLet]:\\"
413                         set DRIVEUNIXPATH($NDRIVES) $FLOPPYPath($i)
414                 } else {
415                         set NLet $i
416                         #set DRIVEDOSPATH($i) "[lindex $lettersF $NLet]:\\"
417                         #set DRIVEUNIXPATH($i) $FLOPPYPath($i)
418                 }
419                 puts $OUTF "\[Drive [lindex $lettersF $NLet]\]"
420                 puts $OUTF "Path=$FLOPPYPath($i)"
421                 puts $OUTF "Type=floppy"
422                 puts $OUTF "Label=Floppy $i"
423                 puts $OUTF "Serial=87654321"
424                 puts $OUTF ""
425         }
426         for  {set i 1} {$i <= $Ncdroms} {set i [expr $i + 1]} {
427                 set NDRIVES [expr $NDRIVES + 1]
428                 puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
429                 puts $OUTF "Path=$CDPath($i)"
430                 set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
431                 set DRIVEUNIXPATH($NDRIVES) $CDPath($i)
432                 puts $OUTF "Type=cdrom"
433                 puts $OUTF "Label=CDROM $i"
434                 puts $OUTF "Filesystem=$UnixFS($i)"
435                 if {$CDDevice($i) != ""} {puts $OUTF "Device=$CDDevice($i)"}
436                 puts $OUTF ""
437         }
438         for  {set i 1} {$i <= $NunixDrives} {set i [expr $i + 1]} {
439                 set NDRIVES [expr $NDRIVES + 1]
440                 puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
441                 set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
442                 set DRIVEUNIXPATH($NDRIVES) $UnixPath($i)
443                 puts $OUTF "Path=$UnixPath($i)"
444                 puts $OUTF "Type=hd"
445                 puts $OUTF "Label=$UnixLabel($i)"
446                 puts $OUTF "Filesystem=$UnixFS($i)"
447                 puts $OUTF ""
448         }
449         for  {set i 1} {$i <= $NnetDrives} {set i [expr $i + 1]} {
450                 set NDRIVES [expr $NDRIVES + 1]
451                 puts $OUTF "\[Drive [lindex $letters $NDRIVES]\]"
452                 set DRIVEDOSPATH($NDRIVES) "[lindex $letters $NDRIVES]:\\"
453                 set DRIVEUNIXPATH($NDRIVES) $NetPath($i)
454                 puts $OUTF "Path=$NetPath($i)"
455                 puts $OUTF "Type=network"
456                 puts $OUTF "Label=$NetLabel($i)"
457                 puts $OUTF "Filesystem=win95"
458                 puts $OUTF ""
459         }
460 }
461
462 proc TkW:MiscEndConf {temp} {
463
464         #Create an acceptable PATH variable, and
465         # gets the TMP WINDOWS and SYSTEM drive letters:
466         global PATH NDRIVES Letter DRIVEPATH
467         global TMPLetter 
468         set PATH ""
469         for {set i 1} {$i<= $NDRIVES} {set i [expr $i + 1]} {
470                 if {[info exists Letter($i)]} {
471                         if {[info exists DRIVEPATH($i)]} {
472                                 if {$DRIVEPATH($i) == $temp} {
473                                         set TMPLetter $Letter($i)
474                                 }
475                                 set PATH "$PATH\;$Letter($i):\\"
476                         }
477                 }
478         }
479         return 
480 }
481
482 proc TkW:Unix2Dos {unixpath} {
483
484         global NDRIVES DRIVEDOSPATH DRIVEUNIXPATH
485
486         set dospath ""
487
488 # First, search the corresponding drive:
489
490         for {set i 1} {$i<=$NDRIVES} {set i [expr $i + 1]} {
491                 set n [string first $DRIVEUNIXPATH($i) $unixpath] 
492                 if {$n == 0} {
493                         set dospath $DRIVEDOSPATH($i)
494                         set N [expr [string length  $DRIVEUNIXPATH($i)] + 1]
495                         break
496                 }
497         }
498         
499 # Now, add the remaining part of the path
500
501         for {set i $N} {$i <= [string length $unixpath]} {set i [expr $i + 1]} {
502
503                 set newchar [string range $unixpath $i $i] 
504                 if {$newchar  != "/"} {
505                         set dospath "$dospath$newchar"
506                 } else {
507                         set dospath "$dospath\\"
508                 }
509         }
510         return $dospath
511 }
512
513 proc TkW:addCdRomDrive {line} {
514         global Ncdroms CDPath CDDevice CDLabel CDType CDSerial CDFS
515
516         global IsCDwrite YES NO WAIT
517
518         if {![file exists [lindex $line 1]]} {return}
519         set Ncdroms [expr $Ncdroms + 1]
520         set  CDFS($Ncdroms) "iso9660"
521         set CDPath($Ncdroms) [lindex $line 1]
522         set dev [lindex $line 0]
523         TkW:message2 "Device $dev $IsCDwrite" $YES $NO
524         set WAIT wait
525         while {$WAIT == "wait"} {update}
526         if {$WAIT == "opt1"} {set CDDevice($Ncdroms) $dev} {set CDDevice($Ncdroms) ""}
527         set CDLabel($Ncdroms) "CDrom"
528 }
529 proc TkW:addNetDrive {line} {
530         global NnetDrives NetPath NetLabel 
531         set NnetDrives [expr $NnetDrives + 1]
532         set NetPath($NnetDrives)  [lindex $line 1]
533         set NetLabel($NnetDrives) [file tail $NetPath($NnetDrives)]
534 }
535 proc TkW:addFloppy {line} {
536         global Nfloppys FLOPPYPath FLOPPYDevice FLOPPYLabel FLOPPYType FLOPPYSerial FLOPPYFS
537         if {![file exists [lindex $line 1]]} {return}
538         set Nfloppys [expr $Nfloppys + 1]
539         set FLOPPYPath($Nfloppys) [lindex $line 1]
540         set FLOPPYDevice($Nfloppys) [lindex $line 0]
541 }
542
543 proc TkW:SortDosDrives {} {
544         global NdosDrives DosDevice DriveRank
545
546         set devlist ""
547         for  {set i 1} {$i <= $NdosDrives} {set i [expr $i + 1]} { 
548                 set  devlist "$devlist $DosDevice($i):TKW:$i"
549         }
550         set devlist [lsort $devlist]
551
552         set i 1
553         foreach dev $devlist {
554                 set n1 [expr [string first ":TKW:" $dev] + 5]
555                 set n2 [string length $dev]
556                 set DriveRank([string range $dev $n1 $n2]) $i
557                 set i [expr $i + 1]
558         }
559 }
560
561 proc TkW:SearchTmp {} {
562         global exclude
563         global NunixDrives UnixPath UnixLabel UnixType UnixFS
564         global NdosDrives DosPath DosLabel DosType DosFS
565         global WAITfilename GetFileName NDRIVES DRIVEUNIXPATH DRIVEDOSPATH
566         global WhereTmp OK CANCEL
567
568 # Check if it /tmp is alreaddy mounted (when it has it's own partition)
569         foreach i $exclude {
570                 if {$i == "/tmp"} {return /tmp}
571         }
572 # check that we have a /tmp:
573         if {[file exists /tmp] } {
574                 set NunixDrives [expr $NunixDrives + 1]
575                 set UnixPath($NunixDrives) /tmp
576                 set exclude "$exclude$UnixPath($NunixDrives) "
577                 set UnixLabel($NunixDrives) "TEMP"
578                 set UnixType($NunixDrives) hd
579                 set UnixFS($NunixDrives) win95
580                 return /tmp
581         } else {
582 #Could add here a search for c:\TEMP or c:|windows\temp
583                 set WAITfilename wait
584                 TkW:GetFileName $WhereTmp $OK $CANCEL Folder
585
586 # check if this folder is on a drive that has an entry in
587 # wineconf (Must be a unix or dos drive)
588                 for {set i 1} {$i<=$NdosDrives} {set i [expr $i +1]} {
589                         if {[string first $DosPath($i) $GetFileName] == 0} {
590                                 return $GetFileName
591                         }
592                 }
593                 for {set i 1} {$i<=$NunixDrives} {set i [expr $i +1]} {
594                         if {[string first $UnixPath($i) $GetFileName] == 0} {
595                                 return $GetFileName
596                         }
597                 }
598 # I'll consider this new one as unix, althought if it's win fs that's ok
599                 set NunixDrives [expr $NunixDrives + 1]
600                 set UnixPath($NunixDrives) $GetFileName
601                 set exclude "$exclude$UnixPath($NunixDrives) "
602                 set UnixLabel($NunixDrives) "TEMP"
603                 set UnixType($NunixDrives) hd
604                 set UnixFS($NunixDrives) win95
605                 return $GetFileName
606         }
607 }
608
609 proc TkW:FindWindows {} {
610
611         global NdosDrives DosPath WINLetter SYSLetter Letter
612
613         #first attempt: C:\windows (would avoid to search)
614
615         if {[file exist $DosPath(1)/windows]} {
616                 return "$DosPath(1)/windows"
617         }
618         
619         for  {set i 1} {$i<=$NdosDrives} {set i [expr $i + 1]} {
620                 set searchWin [open "| find $DosPath($i) -name win.ini -print" r+]
621                 while {![eof $searchWin]} {
622                         gets $searchWin Found
623                         close $searchWin
624                         set Found [file dirname $Found]
625                         return $Found
626                 }
627         }
628         close $searchWin
629         
630 }