Skip to content

Commit a283287

Browse files
authored
Fix order of deleting folders
1 parent 2785653 commit a283287

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

platform.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,15 @@ def _handle_existing_tool(
320320
# Wrong version, reinstall - remove similar paths too
321321
logger.info(f"Reinstalling {tool_name} due to version mismatch")
322322

323-
# Remove the main tool directory
324-
safe_remove_directory(paths['tool_path'])
325-
326-
# Also remove similar directories with version suffixes (e.g., xtensa.12232)
327323
tool_base_name = os.path.basename(paths['tool_path'])
328324
packages_dir = os.path.dirname(paths['tool_path'])
329325

330-
# Remove directories matching pattern like "toolname.*"
326+
# Remove similar directories with version suffixes FIRST (e.g., xtensa.12232)
331327
safe_remove_directory_pattern(packages_dir, f"{tool_base_name}.*")
332328

329+
# Then remove the main tool directory (if it still exists)
330+
safe_remove_directory(paths['tool_path'])
331+
333332
return self.install_tool(tool_name, retry_count + 1)
334333

335334
def _configure_arduino_framework(self, frameworks: List[str]) -> None:

0 commit comments

Comments
 (0)