BaseTools:"--exclude" don't apply if parameter ends with separator

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1944

FormatDosFiles.py Intel\ServerSiliconPkg --exclude Library\SimRegisters\

Its parameter "Library\SimRegisters\" ends with '\'
but I can't seem to get it to exclude the SimRegisters directory

This patch is going to fix this issue

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
This commit is contained in:
Fan, ZhijuX 2019-09-19 15:45:28 +08:00 committed by Liming Gao
parent c70fef962e
commit 6da405ebf6
1 changed files with 1 additions and 0 deletions

View File

@ -53,6 +53,7 @@ def FormatFilesInDir(DirPath, ExtList, Args):
FileNames[:] = [f for f in FileNames if f not in Args.Exclude]
Continue = False
for Path in Args.Exclude:
Path = Path.strip('\\').strip('/')
if not os.path.isdir(Path) and not os.path.isfile(Path):
Path = os.path.join(ExcludeDir, Path)
if os.path.isdir(Path) and Path.endswith(DirPath):