Diff

Differences From Artifact [7f053ee293]:

To Artifact [ce277262eb]:


605
606
607
608
609
610
611

612

613
614
615
616
617
618
619
620


621
622
623
624




625
626
627
628
629
630
631
605
606
607
608
609
610
611
612

613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638







+
-
+








+
+




+
+
+
+







		}

		set localcachefile [download $pathinfo(hostname) $pkgpathinfo(file_sha1)]

		if {$mode == "write"} {
			set tmplocalpath "${localpath}.[expr rand()][clock clicks]"

			set failed 0
			catch {
			if {[catch {
				file mkdir [file dirname $localpath]
				file copy -force -- $localcachefile $tmplocalpath

				if {$pkgpathinfo(perms) == "x"} {
					file attributes $tmplocalpath -permissions +x
				}

				file rename -force -- $tmplocalpath $localpath
			} err]} {
				set failed 1
			}
			catch {
				file delete -force -- $tmplocalpath
			}

			if {$failed} {
				return -code error $err
			}

			return $localpath
		}

		return $localcachefile
	}
}