From 5b500f08ea2618c08b47a99176f323810c924690 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 23 Mar 2022 19:54:04 +0100 Subject: [PATCH] "--portable": make behaviour independent of pyinstaller version pyinstaller 4.3 changed the value of `__file__`. This change makes our behaviour independent of that pyinstaller change (we always behave like old versions of pyinstaller). fixes https://github.com/spesmilo/electrum/issues/7729 regression was introduced by https://github.com/spesmilo/electrum/commit/b5951adc29c1e39335350b8e03c316b41f33ef0f --- run_electrum | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run_electrum b/run_electrum index 901434276..b610f341d 100755 --- a/run_electrum +++ b/run_electrum @@ -331,14 +331,18 @@ def main(): if config_options.get('server'): config_options['auto_connect'] = False - config_options['cwd'] = os.getcwd() + config_options['cwd'] = cwd = os.getcwd() # fixme: this can probably be achieved with a runtime hook (pyinstaller) if is_pyinstaller and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')): config_options['portable'] = True if config_options.get('portable'): - config_options['electrum_path'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data') + if is_pyinstaller: + datadir = os.path.join(os.path.realpath(cwd), 'electrum_data') + else: + datadir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data') + config_options['electrum_path'] = datadir if not config_options.get('verbosity'): warnings.simplefilter('ignore', DeprecationWarning)