Moved some of the process handling code into ROX-Lib.
[rox-archive.git] / AppRun
blob04ce67c5ee586f52ebf7c6abe24d99bdfcbe29e4
1 #!/usr/bin/env python
3 import findrox
4 import sys, os, formats
6 import rox
7 from rox import g, TRUE, FALSE, saving
9 if len(sys.argv) != 2:
10 rox.info("Drag a file or directory onto Archive to archive it. "
11 "Drag an archive onto it to extract.")
12 sys.exit(0)
14 from box import ArchiveBox
16 path = sys.argv[1]
18 if path != '-':
19 path = rox.get_local_path(path)
20 if not path:
21 rox.croak('Sorry, I can only extract/archive local files.')
22 path = os.path.abspath(path)
24 # Show the savebox, so at least the user knows something is happening...
26 savebox = ArchiveBox()
27 savebox.show()
28 g.gdk.flush()
30 if os.path.isdir(path):
31 data = formats.DirData(path)
32 else:
33 data = formats.FileData(path)
34 savebox.set_data(data)
36 rox.mainloop()