Fix exception in class_sqlThread on Windows when loading database

from the file with unicode character in path. Closes: #165.
This commit is contained in:
Dmitri Bogomolov 2020-04-22 13:04:03 +03:00
parent 448e9e2f36
commit b4645c9823
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 7 additions and 6 deletions

View File

@ -29,7 +29,8 @@ class sqlThread(threading.Thread):
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
helper_sql.sql_available = True
self.conn = sqlite3.connect(state.appdata + 'messages.dat')
self.conn = sqlite3.connect(
os.path.join(state.appdata, 'messages.dat'))
self.conn.text_factory = str
self.cur = self.conn.cursor()

View File

@ -23,7 +23,8 @@ def lookupExeFolder():
# targetdir/Bitmessage.app/Contents/MacOS/Bitmessage
os.path.dirname(sys.executable).split(os.path.sep)[0] + os.path.sep
if frozen == "macosx_app" else
os.path.dirname(sys.executable) + os.path.sep)
os.path.dirname(sys.executable).decode(
sys.getfilesystemencoding(), 'ignore') + os.path.sep)
elif __file__:
exeFolder = os.path.dirname(__file__) + os.path.sep
else:
@ -49,11 +50,10 @@ def lookupAppdataFolder():
sys.exit(
'Could not find home folder, please report this message'
' and your OS X version to the BitMessage Github.')
elif 'win32' in sys.platform or 'win64' in sys.platform:
elif sys.platform.startswith('win'):
dataFolder = os.path.join(
os.environ['APPDATA'].decode(
sys.getfilesystemencoding(), 'ignore'), APPNAME
) + os.path.sep
os.environ['APPDATA'], APPNAME
).decode(sys.getfilesystemencoding(), 'ignore') + os.path.sep
else:
try:
dataFolder = os.path.join(os.environ['XDG_CONFIG_HOME'], APPNAME)