diff options
author | Georgy Frolov <gosha@fro.lv> | 2021-01-17 15:57:51 +0300 |
---|---|---|
committer | Georgy Frolov <gosha@fro.lv> | 2021-01-17 15:58:39 +0300 |
commit | 8ee6848271667287787e608815e2596d02b10700 (patch) | |
tree | 6dfaf0f1faa0ed15012b6cc66d18a1f7c0708735 | |
parent | b6b4f9ffcf96bd7a2abc51678562197f59317b4e (diff) |
undo unrelated changes
-rwxr-xr-x | mycli/main.py | 11 | ||||
-rw-r--r-- | mycli/packages/filepaths.py | 17 |
2 files changed, 7 insertions, 21 deletions
diff --git a/mycli/main.py b/mycli/main.py index 7125828..6382d4c 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -52,7 +52,7 @@ from .key_bindings import mycli_bindings from .lexer import MyCliLexer from . import __version__ from .compat import WIN -from .packages.filepaths import dir_path_exists, guess_socket_location, get_default_config_path +from .packages.filepaths import dir_path_exists, guess_socket_location import itertools @@ -94,11 +94,14 @@ class MyCli(object): os.path.expanduser('~/.my.cnf'), ] - default_user_config_file = get_default_config_path() - + # check XDG_CONFIG_HOME exists and not an empty string + if os.environ.get("XDG_CONFIG_HOME"): + xdg_config_home = os.environ.get("XDG_CONFIG_HOME") + else: + xdg_config_home = "~/.config" system_config_files = [ '/etc/myclirc', - default_user_config_file + os.path.join(os.path.expanduser(xdg_config_home), "mycli", "myclirc") ] pwd_config_file = os.path.join(os.getcwd(), ".myclirc") diff --git a/mycli/packages/filepaths.py b/mycli/packages/filepaths.py index 1a0b6b0..79fe26d 100644 --- a/mycli/packages/filepaths.py +++ b/mycli/packages/filepaths.py @@ -1,7 +1,6 @@ import os import platform -from mycli.compat import WIN if os.name == "posix": if platform.system() == "Darwin": @@ -105,19 +104,3 @@ def guess_socket_location(): return os.path.join(r, filename) dirs[:] = [d for d in dirs if d.startswith("mysql")] return None - - -def get_default_config_path(): - # check XDG_CONFIG_HOME exists and not an empty string - if os.environ.get("XDG_CONFIG_HOME"): - xdg_config_home = os.path.expanduser(os.environ.get("XDG_CONFIG_HOME")) - elif WIN: - xdg_config_home = os.path.expanduser("~/AppData/Local") - else: - xdg_config_home = os.path.expanduser("~/.config/") - - config_root = os.path.join(xdg_config_home, 'mycli') - if not os.path.exists(config_root): - os.makedirs(config_root) - - return os.path.join(config_root, 'myclirc') |