Skip to content

Commit

Permalink
portable: don't override portable user preference if not PyInstaller
Browse files Browse the repository at this point in the history
The previous code would set `portable` to `False` when not ran using
PyInstaller, overriding user preference. This meant that AppImage could
not be used portable.

We now only do the portable auto detection when the user hasn't passed
the `--portable` flag already.
  • Loading branch information
EchterAgo committed Apr 17, 2024
1 parent b312722 commit a6f5565
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions electron-cash
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,14 @@ def process_config_options(args):
config_options["auto_connect"] = False
config_options["cwd"] = os.getcwd()

# fixme: this can probably be achieved with a runtime hook (pyinstaller)
try:
tmp_folder = os.path.join(
sys._MEIPASS, # pylint: disable=W0212
"is_portable"
)
config_options["portable"] = is_bundle and os.path.exists(tmp_folder)
except AttributeError:
config_options["portable"] = False
if not config_options.get("portable"):
# auto detect whether we are started from the portable bundle
# we only do this when the user has not already specified portable mode
# fixme: this can probably be achieved with a runtime hook (pyinstaller)
meipass = getattr(sys, "_MEIPASS", None)
if meipass:
tmp_folder = os.path.join(meipass, "is_portable")
config_options["portable"] = is_bundle and os.path.exists(tmp_folder)

if config_options.get("portable"):
config_options["electron_cash_path"] = os.path.join(
Expand Down

0 comments on commit a6f5565

Please sign in to comment.