Skip to content

Commit be7f2c2

Browse files
committed
BUG26802607: Fix reading configuration in Mac OS
According to MY-235 specs: 1. linux and macos must have the config files in $HOME/.mysql/sessions.json and /etc/mysql/sessions.json 2. Windows must have the config files in %APPDATA%MySQLsessions.json and %PROGRAMDATA%MySQLsessions.json
1 parent 101b863 commit be7f2c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/mysqlx/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"""Implementation of Session Configuration"""
2525

2626
import os
27+
import sys
2728
import json
28-
import platform
2929

3030
from .compat import STRING_TYPES
3131
from .errors import OperationalError, InterfaceError
@@ -343,12 +343,14 @@ def items(self):
343343
return self._configs.items()
344344

345345
def _load_default_paths(self):
346-
if platform.system() == "Windows":
346+
if sys.platform.startswith("win"):
347347
self._usr_file = os.path.join(
348348
os.getenv("APPDATA"), "MySQLsessions.json")
349349
self._sys_file = os.path.join(
350350
os.getenv("PROGRAMDATA"), "MySQLsessions.json")
351-
elif platform.system() == "Linux":
351+
elif sys.platform.startswith("linux") or \
352+
sys.platform.startswith("darwin") or \
353+
sys.platform.startswith("sunos"):
352354
self._usr_file = os.path.join(
353355
os.getenv("HOME"), ".mysql", "sessions.json")
354356
self._sys_file = os.path.join(

0 commit comments

Comments
 (0)