Tk Library Source Code

View Ticket
Login
Ticket UUID: 810298
Title: ::fileutil::tempfile can't find temp dir with env
Type: Bug Version: None
Submitter: ingemarh Created on: 2003-09-21 22:51:57
Subsystem: fileutil Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-10-22 04:19:02
Resolution: Out of Date Closed By: andreas_kupries
    Closed on: 2003-10-21 21:19:02
Description:
::fileutil::tempfile has taken its code to set tmpdir 
for any platform from the wiki page 772.
But the code on that page was wrong (now modified)
. The proc tempfile tries to use the env variable 
without making it global.
On Mac it will crash.
On windows and others it will always return current 
directory.

The code should look like this:
switch $tcl_platform(platform) {
    unix {
set tmpdir /tmp   # or even $::env(TMPDIR), at 
times.
    } macintosh {
set tmpdir $::env(TRASH_FOLDER)  ;# a better 
place?
    } default {
set tmpdir [pwd]
catch {set tmpdir $::env(TMP)}
catch {set tmpdir $::env(TEMP)}
    }
 }
User Comments: andreas_kupries added on 2003-10-22 04:19:02:
Logged In: YES 
user_id=75003

This was fixed in the CVS on Sep 3. Excerpt of changelog:

(tempfile): Added 'global env', access to 'env' was bad, 
causing malfunction on windows.