#!/usr/bin/env python

import findrox
import sys, os, formats

import rox
from rox import g, TRUE, FALSE, saving

if len(sys.argv) != 2:
	rox.info("Drag a file or directory onto Archive to archive it. "
		 "Drag an archive onto it to extract.")
	sys.exit(0)

from box import ArchiveBox
		
path = sys.argv[1]

if path != '-':
	path = rox.get_local_path(path)
	if not path:
		rox.croak('Sorry, I can only extract/archive local files.')
	path = os.path.abspath(path)

# Show the savebox, so at least the user knows something is happening...

savebox = ArchiveBox()
savebox.show()
g.gdk.flush()

if os.path.isdir(path):
	data = formats.DirData(path)
else:
	data = formats.FileData(path)
savebox.set_data(data)
	
rox.mainloop()
