Opens the specified directory in the system's file explorer.
(path)
| 285 | |
| 286 | |
| 287 | def open_directory(path): |
| 288 | """Opens the specified directory in the system's file explorer.""" |
| 289 | if os.path.exists(path): |
| 290 | if os.name == 'nt': # Windows |
| 291 | subprocess.Popen(f'explorer "{path}"') |
| 292 | elif os.name == 'posix': # macOS / Linux |
| 293 | subprocess.Popen(['open', path]) # For macOS |
| 294 | # subprocess.Popen(['xdg-open', path]) # For Linux |
| 295 | else: |
| 296 | prRed(f"Directory not found: {path}") |
| 297 | # Example usage: |
| 298 | directory_path = "/home/kali/Desktop/riley_output/results_20250501_175944" # Replace with the actual path |
| 299 | # open_directory(directory_path) |
no test coverage detected