mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 01:38:02 +02:00
Unify resolution of absolute paths or config dir paths
This commit is contained in:
@@ -19,7 +19,9 @@ from kitty.constants import website_url
|
||||
from kitty.fast_data_types import get_options, set_clipboard_string
|
||||
from kitty.key_encoding import KeyEvent
|
||||
from kitty.typing import BossType, KittyCommonOpts
|
||||
from kitty.utils import ScreenSize, screen_size_function, set_primary_selection
|
||||
from kitty.utils import (
|
||||
ScreenSize, resolve_custom_file, screen_size_function, set_primary_selection
|
||||
)
|
||||
|
||||
from ..tui.handler import Handler, result_handler
|
||||
from ..tui.loop import Loop
|
||||
@@ -414,7 +416,6 @@ def load_custom_processor(customize_processing: str) -> Any:
|
||||
return {k: getattr(m, k) for k in dir(m)}
|
||||
if customize_processing == '::linenum::':
|
||||
return {'mark': linenum_marks, 'handle_result': linenum_handle_result}
|
||||
from kitty.constants import resolve_custom_file
|
||||
custom_path = resolve_custom_file(customize_processing)
|
||||
import runpy
|
||||
return runpy.run_path(custom_path, run_name='__main__')
|
||||
|
||||
@@ -10,6 +10,7 @@ from functools import partial
|
||||
from typing import TYPE_CHECKING, Any, Dict, FrozenSet, Generator, List, cast
|
||||
|
||||
from kitty.types import run_once
|
||||
from kitty.utils import resolve_abs_or_config_path
|
||||
|
||||
|
||||
aliases = {'url_hints': 'hints'}
|
||||
@@ -27,11 +28,8 @@ def resolved_kitten(k: str) -> str:
|
||||
|
||||
|
||||
def path_to_custom_kitten(config_dir: str, kitten: str) -> str:
|
||||
path = os.path.expanduser(kitten)
|
||||
if not os.path.isabs(path):
|
||||
path = os.path.join(config_dir, path)
|
||||
path = os.path.abspath(path)
|
||||
return path
|
||||
path = resolve_abs_or_config_path(kitten, None, config_dir)
|
||||
return os.path.abspath(path)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
||||
Reference in New Issue
Block a user