Portable mode is not implemented correctly #379

Closed
opened 2013-08-06 22:22:58 +02:00 by AyrA · 6 comments
AyrA commented 2013-08-06 22:22:58 +02:00 (Migrated from github.com)

Issue

if bitmessage runs in portable mode, relative paths are used to store the files, however, these paths are relative to the Currently selected directory and not the application

Example for Windows

Working example

  1. Create a folder "BM" directly on the C: drive.
  2. Put bitmessage.exe in it and switch to portable mode
  3. exit bitmessage
  4. Open a command prompt ([WIN]+[R] -> "CMD")
  5. Type: CD /D C:\BM
  6. Type bitmessage.exe, The application works as expected

Invalid example

  1. Repeat all steps above, but change the commands from step 5 and 6:
  2. 5: Type: *CD /D C:*
  3. 6: Type BM\bitmessage.exe, The application starts, but thinks it is in C:\

Solution

Two possible approaches:

  • A: Change the Current Directory from bitmessage. This actually may break batch files if it is not reset
  • B: Instead of using raw file names, prepend the path to the bitmessage.exe to the strings
## Issue if bitmessage runs in portable mode, relative paths are used to store the files, however, these paths are relative to the Currently selected directory and not the application ## Example for Windows ### Working example 1. Create a folder "BM" directly on the C: drive. 2. Put bitmessage.exe in it and switch to portable mode 3. exit bitmessage 4. Open a command prompt ([WIN]+[R] -> "CMD") 5. Type: **CD /D C:\BM** 6. Type **bitmessage.exe**, The application works as expected ### Invalid example 1. Repeat all steps above, but change the commands from step 5 and 6: 2. 5: Type: **CD /D C:\** 3. 6: Type **BM\bitmessage.exe**, The application starts, but thinks it is in C:\ ## Solution Two possible approaches: - A: Change the Current Directory from bitmessage. This actually may break batch files if it is not reset - B: Instead of using raw file names, prepend the path to the bitmessage.exe to the strings
grant-olson commented 2013-08-16 23:12:40 +02:00 (Migrated from github.com)

Here's how you get the right path in a way that works with the source distribution or the executable: http://www.pyinstaller.org/export/develop/project/doc/Manual.html#adapting-to-being-frozen It's easy enough to fix, but since I don't have access to a windows machine, I wouldn't be able to test a potential pull request.

Here's how you get the right path in a way that works with the source distribution or the executable: http://www.pyinstaller.org/export/develop/project/doc/Manual.html#adapting-to-being-frozen It's easy enough to fix, but since I don't have access to a windows machine, I wouldn't be able to test a potential pull request.
VADemon commented 2014-04-06 07:53:21 +02:00 (Migrated from github.com)

This issue also affects the option "Start BitMessage on user login" because then it saves keys.dat and messages.dat in System32 or SysWOW64 on Windows systems.

This issue also affects the option "Start BitMessage on user login" because then it saves keys.dat and messages.dat in System32 or SysWOW64 on Windows systems.
PeterSurda commented 2015-11-11 23:52:18 +01:00 (Migrated from github.com)

The path now works when running it on the checked out directory in terminal, and in bundled Windows and OSX. I haven't tried the portable mode yet or the start on login though.

  • Windows bundle
  • OSX bundle
  • Portable mode
  • Start on login
The path now works when running it on the checked out directory in terminal, and in bundled Windows and OSX. I haven't tried the portable mode yet or the start on login though. - [x] Windows bundle - [x] OSX bundle - [x] Portable mode - [x] Start on login
PeterSurda commented 2015-12-13 22:51:43 +01:00 (Migrated from github.com)

@AyrA I fixed it the proper way (B), it detects the directory of the executable, or if running from python manually, the directory with the source code (doesn't make much sense but I think it's the correct approach).

@VADemon It works on Windows startup as well.

@grant-olson The same problem probably affected OSX and this probably fixes it too (I'm too lazy to check).

@AyrA I fixed it the proper way (B), it detects the directory of the executable, or if running from python manually, the directory with the source code (doesn't make much sense but I think it's the correct approach). @VADemon It works on Windows startup as well. @grant-olson The same problem probably affected OSX and this probably fixes it too (I'm too lazy to check).
PeterSurda commented 2015-12-16 16:01:18 +01:00 (Migrated from github.com)

Update re: OSX: if you run it from the DMG archive, portable mode doesn't work, and it's not handled very cleanly. If you run it from the unpacked Bitmessage.app, it will put it into Bitmessage.app/Contents/MacOS. I don't know if that's the correct location but I suppose that's acceptable.

Update re: OSX: if you run it from the DMG archive, portable mode doesn't work, and it's not handled very cleanly. If you run it from the unpacked Bitmessage.app, it will put it into Bitmessage.app/Contents/MacOS. I don't know if that's the correct location but I suppose that's acceptable.
PeterSurda commented 2015-12-16 16:24:16 +01:00 (Migrated from github.com)

9a789c4e24 disables the "Portable mode" checkbox if the app directory is not writable. This fixes the freezes on OSX, and probably some other cases where it wouldn't work.

https://github.com/mailchuck/PyBitmessage/commit/9a789c4e24da3bad5b193be232ed4e4da707be76 disables the "Portable mode" checkbox if the app directory is not writable. This fixes the freezes on OSX, and probably some other cases where it wouldn't work.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2025-02-27#379
No description provided.