Skip to content

Commit 730e718

Browse files
committed
Don't add slash to start of path patterns on Windows
1 parent e818b7a commit 730e718

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/extractor/semmle/projectlayout.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def __init__(self, path, line, virtual=None):
267267
exclude = path
268268
self._line = line;
269269
self._original = u'-' + exclude;
270-
if not exclude.startswith(u"/"):
270+
if os.name != 'nt' and not exclude.startswith(u"/"):
271271
exclude = u'/' + exclude
272272
if exclude.find(u"//") != -1:
273273
raise _error(u"Illegal '//' in exclude path", line)
@@ -284,14 +284,14 @@ def __init__(self, path, line, virtual=None):
284284
include = path
285285
self._line = line;
286286
self._original = include;
287-
if not include.startswith(u"/"):
287+
if os.name != 'nt' and not include.startswith(u"/"):
288288
include = u'/' + include
289289
doubleslash = include.find(u"//")
290290
if doubleslash != include.find(u"//"):
291291
raise _error(u"More than one '//' in include path (project-layout)", line)
292292
if self._verify_stars.match(include):
293293
raise _error(u"Illegal use of '**' in include path (project-layout)", line)
294-
if not virtual.startswith(u"/"):
294+
if os.name != 'nt' and not virtual.startswith(u"/"):
295295
virtual = u"/" + virtual
296296
if virtual.endswith(u"/"):
297297
virtual = virtual[0 : -1]

0 commit comments

Comments
 (0)