@@ -2505,7 +2505,11 @@ def on_download_album_from_track(self, point: QtCore.QPoint) -> None:
25052505 logger_gui .warning ("Could not retrieve album information from the selected track." )
25062506
25072507 def on_show_in_explorer (self , path : pathlib .Path | None ) -> None :
2508- """Open the containing folder and (when possible) select/reveal the file in the OS file manager."""
2508+ """Open the containing folder and (when possible) select/reveal the file in the OS file manager.
2509+
2510+ Args:
2511+ path: Path to the file or directory to show in explorer.
2512+ """
25092513 if not path :
25102514 logger_gui .error ("Attempted to show in explorer but no path was provided" )
25112515 return
@@ -2517,15 +2521,26 @@ def on_show_in_explorer(self, path: pathlib.Path | None) -> None:
25172521 self ._open_in_file_manager (resolved_path )
25182522
25192523 def _resolve_path (self , path : pathlib .Path ) -> pathlib .Path | None :
2520- """Expand and resolve path, log errors if invalid."""
2524+ """Expand and resolve path, log errors if invalid.
2525+
2526+ Args:
2527+ path: The path to resolve.
2528+
2529+ Returns:
2530+ The resolved path, or None if invalid.
2531+ """
25212532 try :
25222533 return path .expanduser ().resolve ()
25232534 except (OSError , RuntimeError ) as e :
25242535 logger_gui .error (f"Invalid path cannot be resolved: { path !s} → { e } " )
25252536 return None
25262537
25272538 def _open_in_file_manager (self , path : pathlib .Path ) -> None :
2528- """Open path in system file manager with platform-specific command."""
2539+ """Open path in system file manager with platform-specific command.
2540+
2541+ Args:
2542+ path: The resolved path to open.
2543+ """
25292544 try :
25302545 if sys .platform == "win32" :
25312546 self ._open_windows (path )
@@ -2537,14 +2552,29 @@ def _open_in_file_manager(self, path: pathlib.Path) -> None:
25372552 logger_gui .exception (f"Unexpected error opening file manager for { path } " )
25382553
25392554 def _open_windows (self , path : pathlib .Path ) -> None :
2555+ """Open path in Windows Explorer.
2556+
2557+ Args:
2558+ path: The path to open.
2559+ """
25402560 cmd = ["explorer" , "/select," , str (path )] if path .is_file () else ["explorer" , str (path )]
25412561 subprocess .Popen (cmd , shell = True ) # noqa: S602 # Required for /select, on Windows; path is trusted
25422562
25432563 def _open_macos (self , path : pathlib .Path ) -> None :
2564+ """Open path in macOS Finder.
2565+
2566+ Args:
2567+ path: The path to open.
2568+ """
25442569 cmd = ["open" , "-R" , str (path )] if path .is_file () else ["open" , str (path )]
25452570 subprocess .run (cmd , check = True ) # noqa: S603 # `open` is trusted system command
25462571
25472572 def _open_linux (self , path : pathlib .Path ) -> None :
2573+ """Open path in Linux file manager.
2574+
2575+ Args:
2576+ path: The path to open.
2577+ """
25482578 target = path .parent if path .is_file () else path
25492579 subprocess .run (["xdg-open" , str (target )], check = True ) # noqa: S603, S607 # `xdg-open` is trusted system utility
25502580
0 commit comments