[sysadmin-bin] ftpadmin: correctly determine basedir for Solaris tar files



commit 0b549ec8cde626a821c5090c09db772f91c26ac5
Author: Olav Vitters <olav vitters nl>
Date:   Fri Apr 8 21:59:53 2011 +0200

    ftpadmin: correctly determine basedir for Solaris tar files

 ftpadmin |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index a20cb4c..db91393 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -330,8 +330,11 @@ class TarInfo(BasicInfo):
                 if info.name in files:
                     self.file[os.path.basename(info.name)] = t.extractfile(info).readlines()
 
-                if file_count == 1 and info.isdir():
-                    uniq_dir = "%s/" % info.name
+                if file_count == 1:
+                    if info.isdir():
+                        uniq_dir = "%s/" % info.name
+                    else
+                        uniq_dir = os.path.basename(info.name.replace("/",os.sep)) if "/" in info.name else None
                 elif uniq_dir is not None and not info.name.startswith(uniq_dir):
                     uniq_dir = None
                 if progress:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]