1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Missed a place to use pathlib.Path()

This commit is contained in:
A_D 2020-12-31 18:47:23 +02:00 committed by Athanasius
parent 63dd6418b9
commit 1a563653da

14
l10n.py
View File

@ -219,15 +219,15 @@ class _Translations:
:return: the opened file (Note: This should be closed when done)
"""
if plugin_path:
f = join(plugin_path, f'{lang}.strings')
if exists(f):
try:
return open(f, 'r', encoding='utf-8')
f = pathlib.Path(plugin_path) / f'{lang}.strings'
if not f.exists():
return None
except Exception:
logger.exception(f'could not open {f}')
try:
return f.open('r', encoding='utf-8')
return None
except OSError:
logger.exception(f'could not open {f}')
elif getattr(sys, 'frozen', False) and platform == 'darwin':
return (self.respath() / f'{lang}.lproj' / 'Localizable.strings').open('r', encoding='utf-16')