A community-maintained Python framework for creating mathematical animations.
Allow open_file to open passed path in file browser if needed.
Aathish2feae76527bd
diff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.pyindex 2f975704b..b0b9069d3 100644--- a/manim/utils/file_ops.py+++ b/manim/utils/file_ops.py@@ -42,17 +42,19 @@ def modify_atime(file_path):os.utime(file_path, times=(time.time(), os.path.getmtime(file_path)))-def open_file(file_path):+def open_file(file_path, in_browser=False):current_os = platform.system()if current_os == "Windows":- os.startfile(file_path)+ os.startfile(file_path if not in_browser else os.path.dirname(file_path))else:if current_os == "Linux":commands = ["xdg-open"]+ file_path = file_path if not in_browser else os.path.dirname(file_path)elif current_os.startswith("CYGWIN"):commands = ["cygstart"]+ file_path = file_path if not in_browser else os.path.dirname(file_path)elif current_os == "Darwin":- commands = ["open"]+ commands = ["open"] if not in_browser else ["open", "-R"]else:raise OSError("Unable to identify your operating system...")commands.append(file_path)