From dee56141402e381a305e2e583793f2380d9a75d5 Mon Sep 17 00:00:00 2001 From: MaXFeeD Date: Tue, 6 May 2025 19:08:42 +0300 Subject: [PATCH] Added FileConfig.get_path_to_config --- src/icmtoolchain/config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/icmtoolchain/config.py b/src/icmtoolchain/config.py index 4e6f01f..a0bb579 100644 --- a/src/icmtoolchain/config.py +++ b/src/icmtoolchain/config.py @@ -1,7 +1,8 @@ from json import JSONDecodeError from json import dump as dump_json from json import load as load_json -from os.path import abspath, basename, dirname, exists, isfile, join, normpath +from os.path import (abspath, basename, dirname, exists, isfile, join, + normpath, relpath) from typing import (Any, Iterable, MutableMapping, MutableSequence, Optional, Protocol, Union, override) @@ -204,3 +205,7 @@ class FileConfig(Config): relative_path = self.get_relative_path(path_from_config) absolute_path = abspath(path_from_config) return absolute_path if not exists(relative_path) and exists(absolute_path) else relative_path + + def get_path_to_config(self, path_from_config: str) -> str: + absolute_path = self.get_path(path_from_config) + return relpath(absolute_path, self.directory)