Add the findDefinitions functions, that return a dict with the filename as key and...
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 18 Dec 2008 11:44:53 +0000 (11:44 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 18 Dec 2008 11:44:53 +0000 (11:44 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2071 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py

index de56cfe6c2c3d3e65105e093c6691d57be841f36..d09b889ce0c80aa372b6f2f34593853c9d0075e2 100644 (file)
@@ -10,6 +10,7 @@
 #
 
 import os
+import fnmatch
 
 def isBertosDir(directory):
    return os.path.exists(directory + "/VERSION")
@@ -21,4 +22,12 @@ def createBertosProject(directory):
     if not os.path.isdir(directory):
         os.mkdir(directory)
     open(directory + "/project.bertos", "w")
-    
\ No newline at end of file
+
+def findDefinitions(ftype, path):
+    l = os.walk(path)
+    definitions = {}
+    for element in l:
+        for filename in element[2]:
+            if fnmatch.fnmatch(filename, "*." + ftype):
+                defintions[filename] = element[0]
+    return definitions
\ No newline at end of file