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:
parent
448e9e2f36
commit
b4645c9823
|
@ -29,7 +29,8 @@ class sqlThread(threading.Thread):
|
||||||
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
|
def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
|
||||||
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
|
"""Process SQL queries from `.helper_sql.sqlSubmitQueue`"""
|
||||||
helper_sql.sql_available = True
|
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.conn.text_factory = str
|
||||||
self.cur = self.conn.cursor()
|
self.cur = self.conn.cursor()
|
||||||
|
|
||||||
|
|
10
src/paths.py
10
src/paths.py
|
@ -23,7 +23,8 @@ def lookupExeFolder():
|
||||||
# targetdir/Bitmessage.app/Contents/MacOS/Bitmessage
|
# targetdir/Bitmessage.app/Contents/MacOS/Bitmessage
|
||||||
os.path.dirname(sys.executable).split(os.path.sep)[0] + os.path.sep
|
os.path.dirname(sys.executable).split(os.path.sep)[0] + os.path.sep
|
||||||
if frozen == "macosx_app" else
|
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__:
|
elif __file__:
|
||||||
exeFolder = os.path.dirname(__file__) + os.path.sep
|
exeFolder = os.path.dirname(__file__) + os.path.sep
|
||||||
else:
|
else:
|
||||||
|
@ -49,11 +50,10 @@ def lookupAppdataFolder():
|
||||||
sys.exit(
|
sys.exit(
|
||||||
'Could not find home folder, please report this message'
|
'Could not find home folder, please report this message'
|
||||||
' and your OS X version to the BitMessage Github.')
|
' 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(
|
dataFolder = os.path.join(
|
||||||
os.environ['APPDATA'].decode(
|
os.environ['APPDATA'], APPNAME
|
||||||
sys.getfilesystemencoding(), 'ignore'), APPNAME
|
).decode(sys.getfilesystemencoding(), 'ignore') + os.path.sep
|
||||||
) + os.path.sep
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
dataFolder = os.path.join(os.environ['XDG_CONFIG_HOME'], APPNAME)
|
dataFolder = os.path.join(os.environ['XDG_CONFIG_HOME'], APPNAME)
|
||||||
|
|
Reference in New Issue
Block a user