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