diff options
-rw-r--r-- | host/utils/uhd_images_downloader.py.in | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 593f7759f..84be10902 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -252,6 +252,8 @@ def main(): help="Do not clear images directory before extracting new files [default=%default]") parser.add_option("-v", "--verbose", action="store_true", default=False, help="Enable verbose output [default=%default]") + parser.add_option("--force-delete", action="store_true", default=False, + help="Delete all files in the target images directory without prompting [default=%default]") (options, args) = parser.parse_args() if options.buffer_size <= 0: print("Invalid buffer size: %s" % (options.buffer_size)) @@ -287,6 +289,18 @@ def main(): else: print("Images destination: %s" % (images_dir)) + ### Check contradictory arguments + if options.force_delete and options.keep: + print("Error: Keep and force delete options contradict.\n") + parser.print_help() + return 1 + + ### Prevent accidental file deletion + if options.install_location != default_images_dir and options.force_delete == False and options.keep != True: + print("Custom install location specified, defaulting to overwriting only image files.\n" + "Use \'--force-delete\' to clean the target directory first.") + options.keep = True + ### Download or copy downloader = uhd_images_downloader() try: |