From 325ceef839707a51daff1ee9b06aed5170b51649 Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Wed, 21 Jun 2023 18:32:42 +0200 Subject: [PATCH] allow folders to be added to the filesystem (#18926) --- pio-tools/post_esp32.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index 370934845..7e4208f70 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -77,7 +77,10 @@ def esp32_build_filesystem(fs_size): else: print("Failed to download: ",file) continue - shutil.copy(file, filesystem_dir) + if os.path.isdir(file): + shutil.copytree(file, filesystem_dir, dirs_exist_ok=True) + else: + shutil.copy(file, filesystem_dir) if not os.listdir(filesystem_dir): print("No files added -> will NOT create littlefs.bin and NOT overwrite fs partition!") return False