summaryrefslogtreecommitdiff
path: root/Master/bin/x86_64-darwin/mtxrun
diff options
context:
space:
mode:
Diffstat (limited to 'Master/bin/x86_64-darwin/mtxrun')
-rwxr-xr-xMaster/bin/x86_64-darwin/mtxrun24
1 files changed, 22 insertions, 2 deletions
diff --git a/Master/bin/x86_64-darwin/mtxrun b/Master/bin/x86_64-darwin/mtxrun
index cc5ebb478ac..049033a727f 100755
--- a/Master/bin/x86_64-darwin/mtxrun
+++ b/Master/bin/x86_64-darwin/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)