summaryrefslogtreecommitdiff
path: root/gerber/layers.py
diff options
context:
space:
mode:
authorju5t <m@ju5t.nl>2018-06-26 22:17:45 +0200
committerju5t <m@ju5t.nl>2018-06-26 22:17:45 +0200
commit8dd8a87fc0fddadd590c926afe6928958d78839a (patch)
treec687ef9970a56056387850b09e6654c97d178c22 /gerber/layers.py
parent31062ba2ce326bf3165c15b325b31b226dc69a11 (diff)
downloadgerbonara-8dd8a87fc0fddadd590c926afe6928958d78839a.tar.gz
gerbonara-8dd8a87fc0fddadd590c926afe6928958d78839a.tar.bz2
gerbonara-8dd8a87fc0fddadd590c926afe6928958d78839a.zip
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.
Diffstat (limited to 'gerber/layers.py')
-rw-r--r--gerber/layers.py6
1 files changed, 3 insertions, 3 deletions
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]