Diff

Differences From Artifact [e6f656d8b6]:

To Artifact [db3d2ea33e]:


    14     14   			if {[info exists ::env($checkenv)]} {
    15     15   				return $::env($checkenv)
    16     16   			}
    17     17   		}
    18     18   		return "/tmp"
    19     19   	}
    20     20   
    21         -	set pkgcachedir [file join [__get_tmpdir] "DELETEME_teapotclient_[string tolower [md5::md5 -hex [list [info script] $::tcl_platform(user)]]].cache"]
           21  +	proc __get_homedir {} {
           22  +		if {[info exists ::env(HOME)]} {
           23  +			return $::env(HOME)
           24  +		}
           25  +
           26  +		catch {
           27  +			set ::env(HOME) [file normalize ~]
           28  +		}
           29  +		if {[info exists ::env(HOME)]} {
           30  +			return $::env(HOME)
           31  +		}
           32  +
           33  +		set ::env(HOME) [file join [__get_tmpdir] FAKEHOME_$tcl_platform(user)]
           34  +		catch {
           35  +			file mkdir $::env(HOME)
           36  +		}
           37  +
           38  +		return $::env(HOME)
           39  +	}
           40  +
           41  +	set pkgcachedir [file join [__get_homedir] ".teapot-client" "cachedir"]
    22     42   
    23     43           # Conversions from Teapot-style names to local ones
    24     44   	set osTeapotToLocal(tcl) *
    25     45   	set osTeapotToLocal(linux-*) linux
    26     46   	set osTeapotToLocal(win32) windows
    27     47   	set osTeapotToLocal(solaris*) solaris
    28     48   	set osTeapotToLocal(freebsd) freebsd_*
................................................................................
   272    292   		foreach pkg [array names pkginfo] {
   273    293   			set pkginfo($pkg) [lsort -decreasing -dictionary $pkginfo($pkg)]
   274    294   		}
   275    295   
   276    296   		return [array get pkginfo]
   277    297   	}
   278    298   
          299  +	proc setcachedir {dir} {
          300  +		set ::teapotclient::pkgcachedir $dir
          301  +	}
   279    302   }
   280    303   
   281    304   package provide teapotclient 0.1