Skip to content

Commit 163f980

Browse files
committed
Revert get_sublime_exe() to return str again
Fixes #1635 Main use cases are forming command line arguments, etc. Hence returning `Path` object is probably just overhead, causing issues.
1 parent f210368 commit 163f980

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

latextools/utils/sublime_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def focus():
3232
sublime.set_timeout(focus, int(wait_time * 1000))
3333

3434

35-
def get_sublime_exe() -> Path:
35+
def get_sublime_exe() -> str:
3636
"""
3737
Get the full path to the currently executing Sublime instance.
3838
@@ -42,8 +42,8 @@ def get_sublime_exe() -> Path:
4242
platform = sublime.platform()
4343
plat_settings = cast(dict, get_setting(platform, {}))
4444
sublime_executable = plat_settings.get("sublime_executable")
45-
if sublime_executable:
46-
return Path(sublime_executable)
45+
if sublime_executable and isinstance(sublime_executable, str):
46+
return sublime_executable
4747

4848
# we cache the results of the other checks, if possible
4949
if hasattr(get_sublime_exe, "result"):
@@ -62,7 +62,7 @@ def get_sublime_exe() -> Path:
6262
elif platform == "windows":
6363
executable = executable.parent / "subl.exe"
6464

65-
get_sublime_exe.result = executable
65+
get_sublime_exe.result = str(executable)
6666
return get_sublime_exe.result
6767

6868

plugins/viewer/command_viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _replace_vars(self, s, pdf_file, tex_file=None, line="", col=""):
5656
if not self.CONTAINS_VARIABLE.search(s):
5757
return (s, False)
5858

59-
sublime_binary = get_sublime_exe() or ""
59+
sublime_binary = get_sublime_exe()
6060

6161
pdf_file_path = os.path.split(pdf_file)[0]
6262
pdf_file_name = os.path.basename(pdf_file)

plugins/viewer/sioyek_viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def forward_sync(self, pdf_file, tex_file, line, col, **kwargs):
4646
"--forward-search-column",
4747
f"{col}",
4848
"--inverse-search",
49-
f'\"{get_sublime_exe()}\" \"%1:%2\"',
49+
f'"{get_sublime_exe()}" "%1:%2"',
5050
pdf_file,
5151
**kwargs
5252
)

0 commit comments

Comments
 (0)