freemyipod r483 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r482‎ | r483 | r484 >
Date:16:30, 22 January 2011
Author:theseven
Status:new
Tags:
Comment:
emcore.py: Add "tree" function
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -1178,6 +1178,23 @@
11791179 self.emcore.dir_close(handle)
11801180
11811181 @command
 1182+ def find(self, path = "/"):
 1183+ """
 1184+ Lists all files in the specified path, recursively
 1185+ [path]: the path which is listed
 1186+ """
 1187+ handle = self.emcore.dir_open(path)
 1188+ self.logger.info(path + "/\n")
 1189+ while True:
 1190+ try:
 1191+ entry = self.emcore.dir_read(handle)
 1192+ if entry.name == "." or entry.name == "..": continue
 1193+ elif entry.attributes & 0x10: self.find(path + "/" + entry.name)
 1194+ else: self.logger.info(path + "/" + entry.name + "\n")
 1195+ except: break
 1196+ self.emcore.dir_close(handle)
 1197+
 1198+ @command
11821199 def malloc(self, size):
11831200 """ Allocates <size> bytes and returns a pointer to the allocated memory """
11841201 size = self._hexint(size)