Skip to content

Commit 99070c0

Browse files
committed
Don't add slash to start of path patterns on Windows
1 parent 4f393f3 commit 99070c0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/extractor/semmle/projectlayout.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import re
1313
from functools import total_ordering
1414
import sys
15+
import os
1516

1617
def get_renamer(filename):
1718
layout = load(filename)
@@ -257,7 +258,7 @@ def __init__(self, path, line, virtual=None):
257258
exclude = path
258259
self._line = line;
259260
self._original = u'-' + exclude;
260-
if not exclude.startswith(u"/"):
261+
if os.name != 'nt' and not exclude.startswith(u"/"):
261262
exclude = u'/' + exclude
262263
if exclude.find(u"//") != -1:
263264
raise _error(u"Illegal '//' in exclude path", line)
@@ -274,14 +275,14 @@ def __init__(self, path, line, virtual=None):
274275
include = path
275276
self._line = line;
276277
self._original = include;
277-
if not include.startswith(u"/"):
278+
if os.name != 'nt' and not include.startswith(u"/"):
278279
include = u'/' + include
279280
doubleslash = include.find(u"//")
280281
if doubleslash != include.find(u"//"):
281282
raise _error(u"More than one '//' in include path (project-layout)", line)
282283
if self._verify_stars.match(include):
283284
raise _error(u"Illegal use of '**' in include path (project-layout)", line)
284-
if not virtual.startswith(u"/"):
285+
if os.name != 'nt' and not virtual.startswith(u"/"):
285286
virtual = u"/" + virtual
286287
if virtual.endswith(u"/"):
287288
virtual = virtual[0 : -1]

0 commit comments

Comments
 (0)