changeset 376:3f84a96cccf6

minor improvements; need a thought or two for the real answer
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 24 Jul 2013 06:59:09 -0700
parents 9314c1008189
children b1c43c980b05
files python/tree.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/python/tree.py	Wed Jul 24 03:10:27 2013 -0700
+++ b/python/tree.py	Wed Jul 24 06:59:09 2013 -0700
@@ -25,16 +25,22 @@
     retval = []
     level = depth(directory)
     directories = {}
+    lvlndctr = []
+    last = {}
+    columns = []
+    lastdepth = depth
     for dirpath, dirnames, filenames in os.walk(directory, topdown=True):
+        basename = os.path.basename(dirpath)
+        parent = os.path.abspath(os.path.dirname(dirpath))
         indent = depth(dirpath) - level
         dirnames[:] = sorted(dirnames, key=lambda x: x.lower())
+        last[os.path.abspath(dirpath)] = dirnames and dirnames[-1] or None
         directories[dirpath] = dirnames
         retval.append('%s%s%s' % ('│' * (indent-1),
-                                  '├' if indent else '',
-                                  os.path.basename(dirpath)))
+                                  ('├' if basename == basename else '└') if indent else '',
+                                  basename))
         filenames = sorted(filenames, key=lambda x: x.lower())
         retval.extend(['%s%s%s' % ('│' * (indent),
-        #                                   '├' if (((index < len(filenames) -1)) or dirnames) else '└',
                                    '├' if (((index < len(filenames) -1)) or dirnames) else '└',
                                     name)
                        for index, name in