summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tltcl
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2020-03-16 20:33:10 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2020-03-16 20:33:10 +0000
commit388c6dc67896b0944f1ee5cb7f1d4e7204f2df82 (patch)
tree5062be4aff54cef067b8117643adb0af03ce0c05 /Master/tlpkg/tltcl
parent2173e912ef9f317f6bd114ce3aa1807cc905b18d (diff)
Fixes for dir_writable
git-svn-id: svn://tug.org/texlive/trunk@54354 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tltcl')
-rw-r--r--Master/tlpkg/tltcl/tltcl.tcl18
1 files changed, 11 insertions, 7 deletions
diff --git a/Master/tlpkg/tltcl/tltcl.tcl b/Master/tlpkg/tltcl/tltcl.tcl
index 11f237b18ce..fdb9deef729 100644
--- a/Master/tlpkg/tltcl/tltcl.tcl
+++ b/Master/tlpkg/tltcl/tltcl.tcl
@@ -548,17 +548,21 @@ proc native_slashify {s} {
proc dir_writable {d} {
for {set x 0} {$x<100} {incr x} {
set y [expr {int(10000*rand())}]
- set newfile [file join $::instroot $y]
+ set newfile [file join $d $y]
if [file exists $newfile] {
continue
} else {
- set fid [open $newfile w]
- chan close $fid
- if [file exists $newfile] {
- file delete $newfile
- return 1
- } else {
+ if [catch {open $newfile w} fid] {
return 0
+ } else {
+ chan puts $fid "hello"
+ chan close $fid
+ if [file exists $newfile] {
+ file delete $newfile
+ return 1
+ } else {
+ return 0
+ }
}
}
}