mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 21:29:08 +00:00
Handle situation where default config directory or file does not exist
- Include khoj_sample.yml in pip package to load default config from - Create khoj config directory if it doesn't exist - Load config from khoj_sample.yml if khoj.yml config doesn't exist
This commit is contained in:
@@ -11,7 +11,7 @@ from src.interface.desktop.file_browser import FileBrowser
|
||||
from src.utils import constants, state, yaml as yaml_utils
|
||||
from src.utils.cli import cli
|
||||
from src.utils.config import SearchType, ProcessorType
|
||||
from src.utils.helpers import merge_dicts
|
||||
from src.utils.helpers import merge_dicts, resolve_absolute_path
|
||||
|
||||
|
||||
class ConfigureScreen(QtWidgets.QDialog):
|
||||
@@ -27,8 +27,9 @@ class ConfigureScreen(QtWidgets.QDialog):
|
||||
self.config_file = config_file
|
||||
|
||||
# Load config from existing config, if exists, else load from default config
|
||||
self.current_config = yaml_utils.load_config_from_file(self.config_file)
|
||||
if self.current_config is None:
|
||||
if resolve_absolute_path(self.config_file).exists():
|
||||
self.current_config = yaml_utils.load_config_from_file(self.config_file)
|
||||
else:
|
||||
self.current_config = yaml_utils.load_config_from_file(constants.app_root_directory / 'config/khoj_sample.yml')
|
||||
self.new_config = self.current_config
|
||||
|
||||
|
||||
Reference in New Issue
Block a user