From a9418cce5370a74397e5ef9c838bbb5980a5cb5d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 3 Apr 2008 16:32:56 +0000 Subject: updates to tlmgr (thanks Hans) git-svn-id: svn://tug.org/texlive/trunk@7298 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/i386-linux/tlmgr | 20 +++++++++----------- Master/bin/win32/tlmgr.texlua | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Master/bin/i386-linux/tlmgr b/Master/bin/i386-linux/tlmgr index ac31a2e677c..0543d040776 100755 --- a/Master/bin/i386-linux/tlmgr +++ b/Master/bin/i386-linux/tlmgr @@ -47,7 +47,7 @@ function setupperl() end function findscript(scriptname) - script = kpse.find_file(scriptname, 'texmfscripts') + local script = kpse.find_file(scriptname, 'texmfscripts') if script then return script else @@ -56,20 +56,18 @@ function findscript(scriptname) end end -function rmdir(dirn) +function rmdir(name) if os.type == 'windows' then - -- we have to replace all / with \ - foo = string.gsub(dirn, '/', '\\') - ret = os.spawn({"rmdir", "/s", "/q", foo}) + -- code from Hans + os.execute("rmdir /s /q " .. name:gsub('/', '\\')) else - ret = os.spawn({"rm", "-rf", dirn}) + ret = os.spawn({"rm", "-rf", name}) end - if ret then - return ret - else - io.stderr:write(filename..': removing '..dirn.." didn't work\n") + local ok = lfs.attributes(name) + if ok then + io.stderr:write(string.format("%s: removing '%s' didn't succeed\n",filename,name) end - return ret + return ok end if string.find(arg[0], '/') then -- UNIX path diff --git a/Master/bin/win32/tlmgr.texlua b/Master/bin/win32/tlmgr.texlua index ac31a2e677c..0543d040776 100755 --- a/Master/bin/win32/tlmgr.texlua +++ b/Master/bin/win32/tlmgr.texlua @@ -47,7 +47,7 @@ function setupperl() end function findscript(scriptname) - script = kpse.find_file(scriptname, 'texmfscripts') + local script = kpse.find_file(scriptname, 'texmfscripts') if script then return script else @@ -56,20 +56,18 @@ function findscript(scriptname) end end -function rmdir(dirn) +function rmdir(name) if os.type == 'windows' then - -- we have to replace all / with \ - foo = string.gsub(dirn, '/', '\\') - ret = os.spawn({"rmdir", "/s", "/q", foo}) + -- code from Hans + os.execute("rmdir /s /q " .. name:gsub('/', '\\')) else - ret = os.spawn({"rm", "-rf", dirn}) + ret = os.spawn({"rm", "-rf", name}) end - if ret then - return ret - else - io.stderr:write(filename..': removing '..dirn.." didn't work\n") + local ok = lfs.attributes(name) + if ok then + io.stderr:write(string.format("%s: removing '%s' didn't succeed\n",filename,name) end - return ret + return ok end if string.find(arg[0], '/') then -- UNIX path -- cgit v1.2.3