mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Fix os.startfile usage to check for availability on Windows
This commit is contained in:
parent
0f0d052166
commit
1f71f4b0e8
1 changed files with 3 additions and 3 deletions
|
|
@ -195,9 +195,9 @@ def modify_atime(file_path: str) -> None:
|
|||
def open_file(file_path: Path, in_browser: bool = False) -> None:
|
||||
current_os = platform.system()
|
||||
if current_os == "Windows":
|
||||
# The method os.startfile is only available in Windows,
|
||||
# ignoring type error caused by this.
|
||||
os.startfile(file_path if not in_browser else file_path.parent)
|
||||
# The method os.startfile is only available in Windows.
|
||||
if hasattr(os, "startfile"):
|
||||
os.startfile(file_path if not in_browser else file_path.parent)
|
||||
else:
|
||||
if current_os == "Linux":
|
||||
commands = ["xdg-open"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue