You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1019 B

5 years ago
  1. from pathlib import Path
  2. from clishared import cli_join_rom, cli_read_rom
  3. print("ThinkPad X230 Bios Dumper v1")
  4. project_name = input("What would you like to name your project? ")
  5. project_path = Path(project_name).resolve()
  6. if project_path.exists():
  7. if project_path.is_file():
  8. raise FileExistsError(f"Cannot create project folder {project_path}, a file already exists here.")
  9. elif project_path.is_dir():
  10. response = input("Folder already exists at this location. Proceed and risk overwriting existing files? (y/N): ")
  11. if not response or (response.strip()[0] not in ['y', 'Y']):
  12. raise FileExistsError(f"Cannot create project folder {project_path}, a directory already exists here.")
  13. else:
  14. project_path.mkdir()
  15. clean_path = project_path / "clean"
  16. if not clean_path.exists():
  17. clean_path.mkdir()
  18. cli_read_rom("bottom", clean_path)
  19. # Bell to remind user to move clip
  20. print("\a", end="")
  21. cli_read_rom("top", clean_path)
  22. cli_join_rom(clean_path)
  23. print("All done.")