summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-12-23 16:54:51 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-12-23 16:54:51 (GMT)
commit8bd7c56459ea9ada6ae0fe177fb471341cfe6416 (patch)
tree8e0f48b2951baa28b94af9ba60afe1845f67208b /Mac
parentf85f052035d92fe2d33d4cf5e4a6111c33c23189 (diff)
downloadcpython-8bd7c56459ea9ada6ae0fe177fb471341cfe6416.zip
cpython-8bd7c56459ea9ada6ae0fe177fb471341cfe6416.tar.gz
cpython-8bd7c56459ea9ada6ae0fe177fb471341cfe6416.tar.bz2
If sys.argv is empty ask for input file and output folder
Diffstat (limited to 'Mac')
-rw-r--r--Mac/scripts/unshar.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Mac/scripts/unshar.py b/Mac/scripts/unshar.py
index fa60e5a..a90ee34 100644
--- a/Mac/scripts/unshar.py
+++ b/Mac/scripts/unshar.py
@@ -69,3 +69,29 @@ def unshar(fp, verbose=0, overwrite=0):
file = None
continue
if verbose: print "...", `line`
+
+def main():
+ import sys
+ import os
+ if len(sys.argv) > 1:
+ for fname in sys.argv[1:]:
+ fp = open(fname, 'r')
+ dir, fn = os.path.split(fname)
+ if dir:
+ os.chdir(dir)
+ unshar(fp)
+ else:
+ import macfs
+ fss, ok = macfs.StandardGetFile('TEXT')
+ if not ok:
+ sys.exit(0)
+ fname = fss.as_pathname()
+ fp = open(fname, 'r')
+ fss, ok = macfs.GetDirectory('Folder to save files in:')
+ if not ok:
+ sys.exit(0)
+ os.chdir(fss.as_pathname())
+ unshar(fp)
+
+if __name__ == '__main__':
+ main()