summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-04 10:29:11 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-04 10:29:11 +0000
commitf77e093ae46db3afc856a90d82e8c8b8b8b98246 (patch)
treeee5b21cbad97ff445c81abd894e9a4477b04a040
parent92059e84b152ae4706252316513d93c84bab7799 (diff)
better version of file.is_writable() from Hans
git-svn-id: svn://tug.org/texlive/trunk@22770 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/context/mtxrun36
-rwxr-xr-xMaster/bin/alpha-linux/mtxrun36
-rwxr-xr-xMaster/bin/amd64-freebsd/mtxrun36
-rwxr-xr-xMaster/bin/amd64-kfreebsd/mtxrun36
-rwxr-xr-xMaster/bin/i386-cygwin/mtxrun36
-rwxr-xr-xMaster/bin/i386-freebsd/mtxrun36
-rwxr-xr-xMaster/bin/i386-kfreebsd/mtxrun36
-rwxr-xr-xMaster/bin/i386-linux/mtxrun36
-rwxr-xr-xMaster/bin/i386-netbsd/mtxrun36
-rwxr-xr-xMaster/bin/i386-solaris/mtxrun36
-rwxr-xr-xMaster/bin/mips-irix/mtxrun36
-rwxr-xr-xMaster/bin/powerpc-aix/mtxrun36
-rwxr-xr-xMaster/bin/powerpc-linux/mtxrun36
-rwxr-xr-xMaster/bin/sparc-linux/mtxrun36
-rwxr-xr-xMaster/bin/sparc-solaris/mtxrun36
-rwxr-xr-xMaster/bin/universal-darwin/mtxrun36
-rwxr-xr-xMaster/bin/win32/mtxrun.lua36
-rwxr-xr-xMaster/bin/x86_64-darwin/mtxrun36
-rwxr-xr-xMaster/bin/x86_64-linux/mtxrun36
-rwxr-xr-xMaster/bin/x86_64-solaris/mtxrun36
-rwxr-xr-xMaster/texmf-dist/scripts/context/lua/mtxrun.lua36
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua36
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/unix/mtxrun36
-rw-r--r--Master/texmf-dist/tex/context/base/l-file.lua31
24 files changed, 335 insertions, 524 deletions
diff --git a/Build/source/texk/texlive/context/mtxrun b/Build/source/texk/texlive/context/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Build/source/texk/texlive/context/mtxrun
+++ b/Build/source/texk/texlive/context/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/alpha-linux/mtxrun b/Master/bin/alpha-linux/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/alpha-linux/mtxrun
+++ b/Master/bin/alpha-linux/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/amd64-freebsd/mtxrun b/Master/bin/amd64-freebsd/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/amd64-freebsd/mtxrun
+++ b/Master/bin/amd64-freebsd/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/amd64-kfreebsd/mtxrun b/Master/bin/amd64-kfreebsd/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/amd64-kfreebsd/mtxrun
+++ b/Master/bin/amd64-kfreebsd/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-cygwin/mtxrun b/Master/bin/i386-cygwin/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-cygwin/mtxrun
+++ b/Master/bin/i386-cygwin/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-freebsd/mtxrun b/Master/bin/i386-freebsd/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-freebsd/mtxrun
+++ b/Master/bin/i386-freebsd/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-kfreebsd/mtxrun b/Master/bin/i386-kfreebsd/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-kfreebsd/mtxrun
+++ b/Master/bin/i386-kfreebsd/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-linux/mtxrun b/Master/bin/i386-linux/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-linux/mtxrun
+++ b/Master/bin/i386-linux/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-netbsd/mtxrun b/Master/bin/i386-netbsd/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-netbsd/mtxrun
+++ b/Master/bin/i386-netbsd/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/i386-solaris/mtxrun b/Master/bin/i386-solaris/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/i386-solaris/mtxrun
+++ b/Master/bin/i386-solaris/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/mips-irix/mtxrun b/Master/bin/mips-irix/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/mips-irix/mtxrun
+++ b/Master/bin/mips-irix/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/powerpc-aix/mtxrun b/Master/bin/powerpc-aix/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/powerpc-aix/mtxrun
+++ b/Master/bin/powerpc-aix/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/powerpc-linux/mtxrun b/Master/bin/powerpc-linux/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/powerpc-linux/mtxrun
+++ b/Master/bin/powerpc-linux/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/sparc-linux/mtxrun b/Master/bin/sparc-linux/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/sparc-linux/mtxrun
+++ b/Master/bin/sparc-linux/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/sparc-solaris/mtxrun b/Master/bin/sparc-solaris/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/sparc-solaris/mtxrun
+++ b/Master/bin/sparc-solaris/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/universal-darwin/mtxrun b/Master/bin/universal-darwin/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/universal-darwin/mtxrun
+++ b/Master/bin/universal-darwin/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/win32/mtxrun.lua b/Master/bin/win32/mtxrun.lua
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/win32/mtxrun.lua
+++ b/Master/bin/win32/mtxrun.lua
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/x86_64-darwin/mtxrun b/Master/bin/x86_64-darwin/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/x86_64-darwin/mtxrun
+++ b/Master/bin/x86_64-darwin/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/x86_64-linux/mtxrun b/Master/bin/x86_64-linux/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/x86_64-linux/mtxrun
+++ b/Master/bin/x86_64-linux/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/bin/x86_64-solaris/mtxrun b/Master/bin/x86_64-solaris/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/bin/x86_64-solaris/mtxrun
+++ b/Master/bin/x86_64-solaris/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index 94867f6eb34..29f2eadb437 100755
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
index 94867f6eb34..29f2eadb437 100755
--- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
index 94867f6eb34..29f2eadb437 100755
--- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
+++ b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
@@ -2524,26 +2524,20 @@ end
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
@@ -11153,11 +11147,9 @@ resolvers.luacnfname = 'texmfcnf.lua'
resolvers.luacnfstate = "unknown"
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}' -- what a rubish path
+resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c},}}'
+
--- changed by Taco Hoekwater to make <root>/texmfnf.lua take precedence,
--- while still allowing <root>/texmf/texmfnf.lua and
--- <root>/texmf/web2c/texmfnf.lua (in that order)
-resolvers.luacnfspec = '{selfautodir:,selfautoparent:};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,};{selfautodir:,selfautoparent:}{/share,}/texmf{-local,}/web2c'
local unset_variable = "unset"
diff --git a/Master/texmf-dist/tex/context/base/l-file.lua b/Master/texmf-dist/tex/context/base/l-file.lua
index 0cc62c730ef..3fea3b0a7c4 100644
--- a/Master/texmf-dist/tex/context/base/l-file.lua
+++ b/Master/texmf-dist/tex/context/base/l-file.lua
@@ -147,30 +147,25 @@ end
--~ print(file.join("//nas-1","/y"))
function file.is_writable(name)
- 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"
+ name = name .. "/m_t_x_t_e_s_t.tmp"
+ local f = io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
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
+ f = io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
end
return false
end
+
function file.is_readable(name)
local a = attributes(name)
return a and sub(a.permissions,1,1) == "r"