Handle relative paths in goto_session

This commit is contained in:
Kovid Goyal 2025-08-14 20:57:02 +05:30
parent 7cf53a6a68
commit c8c0201cbb
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -12,6 +12,7 @@ from gettext import gettext as _
from typing import TYPE_CHECKING, Any, Optional, Sequence, Union
from .cli_stub import CLIOptions
from .constants import config_dir
from .fast_data_types import get_options
from .layout.interface import all_layouts
from .options.types import Options
@ -385,6 +386,10 @@ def goto_session(boss: BossType, cmdline: Sequence[str]) -> None:
if not x.startswith('-'):
path = x
break
path = os.path.expanduser(path)
if not os.path.isabs(path):
path = os.path.join(config_dir, path)
path = os.path.abspath(path)
session_name = session_arg_to_name(path)
if not session_name:
boss.show_error(_('Invalid session'), _('{} is not a valid path for a session').format(path))