From 8c1cd92addc8cf56e3cb804fb88f323c6d5f8b1a Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Wed, 29 Jul 2015 16:40:34 -0700 Subject: [PATCH] fix(bin/linja.in): recursively find all files in a pattern endswith / Example: If you have an entry in .project file such as - theories/ It will remove all files under 'theories' directory from the project related issue: leanprover/lean.js#3 --- bin/linja.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/linja.in b/bin/linja.in index 9cae9bddb..7d84adfda 100755 --- a/bin/linja.in +++ b/bin/linja.in @@ -551,9 +551,14 @@ def get_lean_names(lean_file, args, using_hlean): item['clean'] = args.cache return item +def recursive_glob(directory): + return [os.path.join(dirpath, f) + for dirpath, dirnames, files in os.walk(directory) + for f in fnmatch.filter(files, '*')] + def find_files(directory, pattern): - if "/" in pattern: - return glob.glob(os.path.join(directory, pattern)) + if pattern.endswith("/"): + return recursive_glob(os.path.join(directory, pattern)) matches = [] for root, dirnames, filenames in os.walk(directory): for filename in fnmatch.filter(filenames, pattern):