Skip to content

Add portable mode support for Persepolis#1117

Open
mgh12453 wants to merge 1 commit intopersepolisdm:masterfrom
mgh12453:claude/implement-portable-mode-SH1cl
Open

Add portable mode support for Persepolis#1117
mgh12453 wants to merge 1 commit intopersepolisdm:masterfrom
mgh12453:claude/implement-portable-mode-SH1cl

Conversation

@mgh12453
Copy link
Copy Markdown

Summary

This PR adds portable mode support to Persepolis, allowing the application to store all configuration, settings, and download data in a directory alongside the executable rather than in the user's home directory. This is useful for running Persepolis from USB drives or other portable storage.

Key Changes

  • Portable mode detection: Added _getPortableMarkerDir(), isPortableMode(), and setForcePortableMode() functions to detect and manage portable mode via a portable marker file or --portable CLI argument
  • Centralized QSettings creation: Introduced createQSettings() function that returns platform-appropriate QSettings (INI file in portable mode, registry/defaults in normal mode)
  • Config folder redirection: Modified determineConfigFolder() to return persepolis_data subdirectory when in portable mode
  • Download path adjustment: Updated returnDefaultSettings() to use portable data directory for downloads in portable mode
  • CLI argument support: Added --portable command-line flag that forces portable mode and creates the marker file if needed
  • Windows mutex isolation: Modified Windows mutex naming to include a hash of the config path in portable mode, allowing multiple portable instances to run simultaneously
  • Browser integration disable: Disabled browser native messaging integration in portable mode to avoid system-wide registry/config modifications
  • Early initialization: Added early portable mode detection in persepolis.py before any config folders are computed
  • Consistent QSettings usage: Updated all QSettings instantiations across the codebase to use createQSettings() for consistency
  • Browser integration script support: Added portable mode detection to PersepolisBI.py for the browser integration helper

Implementation Details

  • The portable marker file is created automatically when --portable is used if it doesn't already exist
  • Portable mode works with both bundled (PyInstaller/Nuitka) and source installations
  • The portable.example file serves as documentation for manual portable mode activation
  • All data paths (settings, database, downloads) are redirected to the persepolis_data subdirectory in portable mode
  • The implementation maintains backward compatibility with existing non-portable installations

When a file named 'portable' exists alongside the executable (or repo
root for dev mode), all data is stored in a 'persepolis_data' subfolder
instead of system directories. Also supports --portable CLI flag which
creates the marker file automatically.

- QSettings uses INI file instead of registry in portable mode
- Default download path points to persepolis_data/Downloads/
- Browser integration is skipped in portable mode
- Windows mutex includes path hash for portable coexistence

Closes persepolisdm#279

https://claude.ai/code/session_01VU149ugqp2U5ZGjkV8y6Cm
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

Successfully merging this pull request may close these issues.

2 participants