summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Shi <steven.shi@intel.com>2019-09-18 11:21:09 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-09-19 08:48:31 +0800
commitb0c15fb128c518b9acd8611a2deea213e9e55193 (patch)
tree9c197593012dfe4092e3520a015e40c6c928d823
parent82c1a2120855e7fe32417870910f4ce20dca97a3 (diff)
downloadedk2-b0c15fb128c518b9acd8611a2deea213e9e55193.zip
edk2-b0c15fb128c518b9acd8611a2deea213e9e55193.tar.gz
edk2-b0c15fb128c518b9acd8611a2deea213e9e55193.tar.bz2
BaseTools: Add more parameter checking for CopyFileOnChange()
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2193 The current CopyFileOnChange() method in Misc.py does not accept the input SrcFile parameter as a dir, but the method does not check the SrcFile is dir or not. This patch is to add more input parameter type checking and error message output for method CopyFileOnChange. Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Steven Shi <steven.shi@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-rwxr-xr-xBaseTools/Source/Python/Common/Misc.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 714eb84..a488536 100755
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -536,7 +536,8 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=None):
SrcFile = LongFilePath(SrcFile)
Dst = LongFilePath(Dst)
- if not os.path.exists(SrcFile):
+ if os.path.isdir(SrcFile):
+ EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData='CopyFileOnChange SrcFile is a dir, not a file: %s' % SrcFile)
return False
if os.path.isdir(Dst):