From 1563f1bb7d25dfaf1686d191ab35cac8166d677d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 18 Apr 2008 05:29:05 +0000 Subject: use rmtree instead of rmdir git-svn-id: svn://tug.org/texlive/trunk@7482 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr.texlua | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'Master/texmf') diff --git a/Master/texmf/scripts/texlive/tlmgr.texlua b/Master/texmf/scripts/texlive/tlmgr.texlua index 7b6f581012b..bbb5395e184 100755 --- a/Master/texmf/scripts/texlive/tlmgr.texlua +++ b/Master/texmf/scripts/texlive/tlmgr.texlua @@ -59,16 +59,19 @@ end -- function from Reinhard, could replace rmdir, needs testing function rmtree (path) - for file in lfs.dir(path) do - if file ~= '.' and file ~= '..' then - local f = path..'/'..file - if lfs.isdir(f) then - rmtree(f) - print ('lfs.rmdir '..f) -- lfs.rmdir(f) - else - print ('os.remove '..f) -- os.remove(f) + if lfs.isdir(path) then + for file in lfs.dir(path) do + if file ~= '.' and file ~= '..' then + local f = path..'/'..file + if lfs.isdir(f) then + rmtree(f) + lfs.rmdir(f) + else + os.remove(f) + end end end + lfs.rmdir(path) end end @@ -137,15 +140,15 @@ if arg[1] == 'uninstall' then -- on unix we have removed the symlinks in case they were present -- -- now we have to remove all the files and directories - rmdir(TEXDIR.."/texmf-dist") - rmdir(TEXDIR.."/texmf-doc") - rmdir(TEXDIR.."/texmf-var") - rmdir(TEXDIR.."/texmf-config") - rmdir(TEXDIR.."/texmf") - rmdir(TEXDIR.."/tlpkg") + rmtree(TEXDIR.."/texmf-dist") + rmtree(TEXDIR.."/texmf-doc") + rmtree(TEXDIR.."/texmf-var") + rmtree(TEXDIR.."/texmf-config") + rmtree(TEXDIR.."/texmf") + rmtree(TEXDIR.."/tlpkg") os.remove(TEXDIR.."/temp") os.remove(TEXDIR.."/install-tl.log") - rmdir(TEXDIR.."/bin") + rmtree(TEXDIR.."/bin") -- now everything should be removed, try to remove also TEXDIR -- this will not succeed on win32 since texlua.exe is still in use -- and thus removing TEXDIR/bin will not work. Damned. -- cgit v1.2.3