diff --git a/nbdev/config.py b/nbdev/config.py index 50fddab6e..72b735873 100644 --- a/nbdev/config.py +++ b/nbdev/config.py @@ -181,10 +181,8 @@ def nbdev_create_config( # %% ../nbs/api/01_config.ipynb def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None): - cfg_path = path = Path.cwd() if path is None else Path(path) - while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent - if not (cfg_path/cfg_name).exists(): cfg_path = path - return cfg_path/cfg_name + cfg_path = Path.cwd() if path is None else Path(path) + return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name) # %% ../nbs/api/01_config.ipynb def _xdg_config_paths(cfg_name=_nbdev_cfg_name): diff --git a/nbs/api/01_config.ipynb b/nbs/api/01_config.ipynb index 397c5c029..465e266bd 100644 --- a/nbs/api/01_config.ipynb +++ b/nbs/api/01_config.ipynb @@ -402,10 +402,8 @@ "source": [ "#|export\n", "def _nbdev_config_file(cfg_name=_nbdev_cfg_name, path=None):\n", - " cfg_path = path = Path.cwd() if path is None else Path(path)\n", - " while cfg_path != cfg_path.parent and not (cfg_path/cfg_name).exists(): cfg_path = cfg_path.parent\n", - " if not (cfg_path/cfg_name).exists(): cfg_path = path\n", - " return cfg_path/cfg_name" + " cfg_path = Path.cwd() if path is None else Path(path)\n", + " return getattr(Config.find(cfg_name), 'config_file', cfg_path/cfg_name)" ] }, {