[Dev-luatex] writing a rmdir function in texlua

Norbert Preining preining at logic.at
Thu Apr 3 18:09:41 CEST 2008


Hi all,

for the TeX Live uninstaller I am trying to write a rmdir function for
win32 in texlua which should work like rm -rf on unix.

My first try was:
function rmdir(dirn)
  if os.type == 'windows' then
    -- we have to replace all / with \
    foo = string.gsub(dirn, '/', '\\')
    ret = os.spawn({"rmdir", "/s", "/q", foo})
  else
    ret = os.spawn({"rm", "-rf", dirn})
  end
  if ret then
    return ret
  else
    io.stderr:write(filename..': removing '..dirn.." didn't work\n")
  end
  return ret
end

(No checks by now, will come later ...)

But that didn't work and did spit out always the io.stderr message.

Any suggestion how to do that? Or is there some code already somewhere
around in the ConTeXt project?


Thanks and all the best


Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining at logic.at>        Vienna University of Technology
Debian Developer <preining at debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
Queasy but umbowed. The kind of feeling one gets when discovering a
plastic compartment in a fridge in which thing are growing.
			--- Douglas Adams, The Meaning of Liff


More information about the dev-luatex mailing list