More fixes for creating/extracting directories.
[rox-archive.git] / AppRun
blobffe8cedd6767ceb17a799a57aacae071f0b02b77
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 support import escape, Tmp, pipe_through_command
16 from box import ArchiveBox
18 # Check that our input is a regular local file.
19 # If not, fetch the data and put it in /tmp.
21 path = sys.argv[1]
23 if path != '-':
24 path = rox.get_local_path(path)
25 if not path:
26 rox.croak('Sorry, I can only extract/archive local files.')
27 path = os.path.abspath(path)
29 # Show the savebox, so at least the user knows something is happening..
31 savebox = ArchiveBox()
32 savebox.show()
33 g.gdk.flush()
35 if os.path.isdir(path):
36 data = formats.DirData(path)
37 else:
38 data = formats.FileData(path)
39 savebox.set_data(data)
41 rox.mainloop()