Bug 1798660 - Drive-by: Use a better test for IsInDir. r=gsvelto

Differential Revision: https://phabricator.services.mozilla.com/D163301
This commit is contained in:
Mike Hommey 2022-11-30 04:57:39 +00:00
parent 65c94f1b70
commit a837f93948

View File

@ -314,10 +314,11 @@ else:
def IsInDir(file, dir):
# the lower() is to handle win32+vc8, where
# the source filenames come out all lowercase,
# but the srcdir can be mixed case
return os.path.abspath(file).lower().startswith(os.path.abspath(dir).lower())
try:
Path(file).relative_to(dir)
return True
except ValueError:
return False
def GetVCSFilenameFromSrcdir(file, srcdir):