Write the configuration to a platformio.ini file. Args: file_path: Path to write the configuration to
(self, file_path: Path)
| 1006 | return instance |
| 1007 | |
| 1008 | def dump(self, file_path: Path) -> None: |
| 1009 | """ |
| 1010 | Write the configuration to a platformio.ini file. |
| 1011 | |
| 1012 | Args: |
| 1013 | file_path: Path to write the configuration to |
| 1014 | """ |
| 1015 | |
| 1016 | # Write atomically using a temporary file |
| 1017 | temp_file = file_path.with_suffix(".tmp") |
| 1018 | try: |
| 1019 | with open(temp_file, "w", encoding="utf-8") as f: |
| 1020 | self.config.write(f) |
| 1021 | temp_file.replace(file_path) |
| 1022 | logger.debug(f"Successfully wrote platformio.ini: {file_path}") |
| 1023 | except KeyboardInterrupt as ki: |
| 1024 | handle_keyboard_interrupt(ki) |
| 1025 | raise |
| 1026 | except Exception as e: |
| 1027 | if temp_file.exists(): |
| 1028 | temp_file.unlink() |
| 1029 | logger.error(f"Failed to write platformio.ini: {e}") |
| 1030 | raise |
| 1031 | |
| 1032 | def get_sections(self) -> list[str]: |
| 1033 | """ |