Allow not using files from user_dir

This commit is contained in:
Matthias 2019-10-30 15:55:35 +01:00
parent de2cc58b0c
commit 44289e4c58
2 changed files with 6 additions and 6 deletions

View File

@ -17,13 +17,13 @@ class IResolver:
This class contains all the logic to load custom classes This class contains all the logic to load custom classes
""" """
def build_search_paths(self, config, current_path: Path, user_subdir: str, def build_search_paths(self, config, current_path: Path, user_subdir: Optional[str] = None,
extra_dir: Optional[str] = None) -> List[Path]: extra_dir: Optional[str] = None) -> List[Path]:
abs_paths = [ abs_paths: List[Path] = [current_path]
config['user_data_dir'].joinpath(user_subdir),
current_path, if user_subdir:
] abs_paths.insert(0, config['user_data_dir'].joinpath(user_subdir))
if extra_dir: if extra_dir:
# Add extra directory to the top of the search paths # Add extra directory to the top of the search paths

View File

@ -40,7 +40,7 @@ class PairListResolver(IResolver):
current_path = Path(__file__).parent.parent.joinpath('pairlist').resolve() current_path = Path(__file__).parent.parent.joinpath('pairlist').resolve()
abs_paths = self.build_search_paths(config, current_path=current_path, abs_paths = self.build_search_paths(config, current_path=current_path,
user_subdir='pairlist', extra_dir=None) user_subdir=None, extra_dir=None)
pairlist = self._load_object(paths=abs_paths, object_type=IPairList, pairlist = self._load_object(paths=abs_paths, object_type=IPairList,
object_name=pairlist_name, kwargs=kwargs) object_name=pairlist_name, kwargs=kwargs)