open_folder.py 579 B

123456789101112131415161718192021222324
  1. import subprocess
  2. import sys
  3. if sys.platform == "darwin":
  4. def open_folder(folder_path: str):
  5. subprocess.check_call(["open", "--", folder_path])
  6. elif sys.platform.startswith("linux"):
  7. def open_folder(folder_path: str):
  8. subprocess.check_call(["xdg-open", folder_path])
  9. elif sys.platform == "win32":
  10. def open_folder(folder_path: str):
  11. subprocess.Popen(["explorer", folder_path])
  12. if __name__ == "__main__":
  13. # open_folder("./data/models/")
  14. import os
  15. open_folder(os.path.join(os.path.dirname(__file__), "..", "data", "models"))