From 92406ab008c9cf2861e9272ae63e5b4b881bbe20 Mon Sep 17 00:00:00 2001 From: duplo Date: Thu, 18 Dec 2008 11:44:53 +0000 Subject: [PATCH] Add the findDefinitions functions, that return a dict with the filename as key and the path as value git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2071 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/bertos_utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index de56cfe6..d09b889c 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -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 -- 2.25.1