diff --git a/tools/oneclick/base/hdl_config.py b/tools/oneclick/base/hdl_config.py index 044516c464154dead5e796f281a4b1bc75883310..f2030e3f30640d8cef9743f8033fecad41a24099 100644 --- a/tools/oneclick/base/hdl_config.py +++ b/tools/oneclick/base/hdl_config.py @@ -53,6 +53,7 @@ import sys import os import os.path import shutil +from distutils.dir_util import copy_tree import argparse class HdlConfig: @@ -313,16 +314,9 @@ class HdlConfig: sourcePathName = cm.expand_file_path_name(fpn_io[0], lib_path) destinationPath = cm.expand_file_path_name(fpn_io[1], build_dir_path) if os.path.isfile(sourcePathName): - shutil.copy(sourcePathName, destinationPath) # copy file + shutil.copy(sourcePathName, destinationPath) # copy file else: - if os.path.exists(destinationPath): - if build_dir_path in destinationPath: - # Only automatically remove the destinationPath if it is in the build_dir_path to avoid accidentally removing an important directory - shutil.rmtree(destinationPath) - else: - # If the destination directory is outside the build_dir_path then require that it does not already exist - sys.exit('Error : First manually remove destination directory %s' % destinationPath) - shutil.copytree(sourcePathName, destinationPath) # copy directory tree (will create new destinationPath directory) + copy_tree(sourcePathName, destinationPath) # copy directory tree (will create new destinationPath directory) if __name__ == '__main__':