From 8dd8a87fc0fddadd590c926afe6928958d78839a Mon Sep 17 00:00:00 2001 From: ju5t Date: Tue, 26 Jun 2018 22:17:45 +0200 Subject: Match full filename instead of the base name Regular expressions only matched the base name. This matches the entire filename which allows for more advanced regular expressions. --- gerber/layers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gerber/layers.py') diff --git a/gerber/layers.py b/gerber/layers.py index c80baa4..5c26412 100644 --- a/gerber/layers.py +++ b/gerber/layers.py @@ -122,11 +122,11 @@ def guess_layer_class(filename): pass try: - directory, name = os.path.split(filename) - name, ext = os.path.splitext(name.lower()) + directory, filename = os.path.split(filename) + name, ext = os.path.splitext(filename.lower()) for hint in hints: if hint.regex: - if re.findall(hint.regex, name, re.IGNORECASE): + if re.findall(hint.regex, filename, re.IGNORECASE): return hint.layer patterns = [r'^(\w*[.-])*{}([.-]\w*)?$'.format(x) for x in hint.name] -- cgit