Skip to content

Commit

Permalink
refactor: tidy codes
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <[email protected]>
  • Loading branch information
jfcherng committed Oct 22, 2024
1 parent e3af069 commit e34df5c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugin/commands/open_git_repo_on_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import threading
from functools import lru_cache, wraps
from pathlib import Path
from typing import Any, Callable, Final, TypeVar, cast
from typing import Any, Callable, TypeVar, cast

import sublime
import sublime_plugin
Expand Down Expand Up @@ -42,8 +42,8 @@ def __init__(
encoding: str = "utf-8",
timeout_s: float = 3,
) -> None:
self.git_bin = git_bin
self.workspace = workspace
self.git_bin = str(git_bin)
self.workspace = Path(workspace)
self.encoding = encoding
self.timeout_s = timeout_s

Expand Down Expand Up @@ -180,8 +180,10 @@ def find_git_bin() -> str | None:
if os.name == "nt":
if sublime_merge_path:
candidates.append(Path(sublime_merge_path) / "Git/cmd/git.exe")
candidates.append(R"C:\Program Files\Sublime Merge\Git\cmd\git.exe")
candidates.append(Path(sublime.executable_path()) / "../../Sublime Merge/Git/cmd/git.exe")
candidates.extend((
R"C:\Program Files\Sublime Merge\Git\cmd\git.exe", # default installation
Path(sublime.executable_path()) / "../../Sublime Merge/Git/cmd/git.exe", # neighbor installation
))

return first_true(map(shutil.which, map(str, candidates)))

Expand Down

0 comments on commit e34df5c

Please sign in to comment.