From dab60a1cb7ea9b0f048ef2f0ff711442d8846c6e Mon Sep 17 00:00:00 2001 From: Graham Reed Date: Fri, 19 Aug 2022 16:48:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20LPC1768=20automatic=20uplo?= =?UTF-8?q?ad=20port=20(#24599)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/LPC1768/upload_extra_script.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/upload_extra_script.py b/Marlin/src/HAL/LPC1768/upload_extra_script.py index 3e23c63ca1..2db600abc7 100755 --- a/Marlin/src/HAL/LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/LPC1768/upload_extra_script.py @@ -82,11 +82,11 @@ if pioutil.is_pio_build(): for drive in drives: try: fpath = mpath / drive - files = [ x for x in fpath.iterdir() if x.is_file() ] + filenames = [ x.name for x in fpath.iterdir() if x.is_file() ] except: continue else: - if target_filename in files: + if target_filename in filenames: upload_disk = mpath / drive target_file_found = True break @@ -104,21 +104,21 @@ if pioutil.is_pio_build(): # platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive' # dpath = Path('/Volumes') # human readable names - drives = [ x for x in dpath.iterdir() ] + drives = [ x for x in dpath.iterdir() if x.is_dir() ] if target_drive in drives and not target_file_found: # set upload if not found target file yet target_drive_found = True upload_disk = dpath / target_drive for drive in drives: try: - fpath = dpath / drive # will get an error if the drive is protected - files = [ x for x in fpath.iterdir() ] + fpath = dpath / drive # will get an error if the drive is protected + filenames = [ x.name for x in fpath.iterdir() if x.is_file() ] except: continue else: - if target_filename in files: - if not target_file_found: - upload_disk = dpath / drive + if target_filename in filenames: + upload_disk = dpath / drive target_file_found = True + break # # Set upload_port to drive if found