DSL Ideas and Suggestions :: Lua .tar.gz - Viewer



hello,

i like rox and think, that this filemanager is a perfect tool to make dsl more comfortable for newbies.

i another flua-script to improve rox' ability to browse around:
Code Sample
#!/bin/flua -f

-- Archive einsehen

if getn(arg) == 1 then
  archive = arg[1]
else
  print("usage: viewTarGz.lua [archive]")
  exit(1)
end

execute('tar -ztf '..archive..' > index.txt')
local file,err = openfile("index.txt", "r")

if not file then
  print("Cannot open file index.txt: ".. err)
  exit(1)
end

filetable = {}
fname = tmpname()
filelist = openfile(fname,"w")
line = read(file, "*l")
while line do
  result = line
  if result then
     tinsert(filetable,result)
     write(filelist, result .. "\n")
  end
  line = read(file,"*l")
end
closefile(file)
closefile(filelist)

w = Window{250,300,archive}
function w:callback()
 remove(fname)
 remove('index.txt')
 exit(0)
end

browser = Browser{0,0,250,300}

if not browser:load(fname) then
  print("can't load ", fname)
  exit(1)
end

browser.position = 0
w.resizable = browser
w:show()


use this script as "run action" for rox and you can view the content of all *.tar.gz-files.

Or, you can just double-click the tar.gz file in emelfm, and you can view the contents, or even use what's inside if you want. When you are done, you can either repack the tarball with your changes, of leave it as it was.

-J.P.


original here.