Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how --portable behaves (location of datadir) #7732

Closed
SomberNight opened this issue Mar 23, 2022 · 1 comment
Closed

Clarify how --portable behaves (location of datadir) #7732

SomberNight opened this issue Mar 23, 2022 · 1 comment
Assignees
Milestone

Comments

@SomberNight
Copy link
Member

I find the behaviour of the --portable/-P flag confusing, and in some cases unintended.

Note that the "portable" Windows exe we distribute works by implicitly setting --portable. The user can also manually set the flag regardless of how they run Electrum.

For context, Electrum normally places its data directory (config file, wallet files, block headers, lightning gossip, etc) at ~/.electrum (or %APPDATA%/Electrum on Windows). The --portable flag is there to change this: if set, Electrum will instead create a folder named electrum_data at ... well it depends, but usually in $PWD (the current working directory).

The current behaviour is as follows:

  • "pyinstaller" case: portable .exe, other .exes with --portable, and .dmg with --portable
    • uses $PWD
    • note that when you double-click the portable .exe on Windows, $PWD is set to the parent folder, i.e. the datadir gets put next to the .exe
  • appimage --portable
  • git clone
    • next to run_electrum
  • unpacking tar.gz and running locally from it
    • next to run_electrum
  • pip install *.tar.gz, and calling "electrum --portable" from terminal
    • uses python's user script directory
      • ~/.local/bin/electrum_data
      • $VIRTUAL_ENV/bin/electrum_data

I would like to consolidate this... but I realise some users might be relying on current behaviour.
I think the clean solution would be to simply always use $PWD, however, to minimise breakage, I suggest the following:

  • "pyinstaller" case: portable .exe, other .exes with --portable, and .dmg with --portable
    • uses $PWD
  • appimage --portable
    • (CHANGED) uses $PWD
  • git clone
    • next to run_electrum
  • unpacking tar.gz and running locally from it
    • next to run_electrum
  • pip install *.tar.gz, and calling "electrum --portable" from terminal
    • (CHANGED) uses $PWD

That is, the only breaking change is re the last case, but I hope no one is relying on that ~madness.

@SomberNight SomberNight self-assigned this Mar 23, 2022
@SomberNight SomberNight added this to the 4.2.1 milestone Mar 23, 2022
@SomberNight
Copy link
Member Author

Note: technically this is a breaking change but I think it is ok for it to get included in 4.2.1.
I doubt anyone was relying on behaviour that changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant