summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-03 07:55:34 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-03 07:55:34 +0000
commit5833bdb286cd1a35b6fd7660bc41f185108bd5ad (patch)
tree4a1a8f1e2dfe8610063b38338a22d9ed5de7a475 /Build
parentc4bd9e62374a625f2342ffccd541cae108f17ad3 (diff)
Fix ConTeXt's writable TEXMFCACHE discovery
git-svn-id: svn://tug.org/texlive/trunk@22753 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/texk/texlive/context/mtxrun24
1 files changed, 22 insertions, 2 deletions
diff --git a/Build/source/texk/texlive/context/mtxrun b/Build/source/texk/texlive/context/mtxrun
index cc5ebb478ac..049033a727f 100755
--- a/Build/source/texk/texlive/context/mtxrun
+++ b/Build/source/texk/texlive/context/mtxrun
@@ -2524,8 +2524,28 @@ end
function file.is_writable(name)
- local a = attributes(name) or attributes(dirname(name,"."))
- return a and sub(a.permissions,2,2) == "w"
+ if os.type == "windows" then
+ local a = attributes(name) or attributes(dirname(name,"."))
+ return a and sub(a.permissions,2,2) == "w"
+ end
+ local f
+ local isnew = true
+ if lfs.isdir(name) then
+ name = name .. "/mtxtest.txt"
+ else
+ f = io.open(name, "rb");
+ if f then
+ f:close()
+ isnew = false
+ end
+ end
+ f = io.open(name, "wb");
+ if f then
+ f:close()
+ if isnew then os.remove(name) end
+ return true
+ end
+ return false
end
function file.is_readable(name)