Skip to content

feat(desktop): support custom user data directories - #756

Merged
murongg merged 1 commit into
v2from
feature/755-user-data-dir
Oct 11, 2026
Merged

murongg merged 1 commit into
v2from
feature/755-user-data-dir

Conversation

@murongg

@murongg murongg commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Markra currently ignores --user-data-dir, so a portable executable still uses the system profile. This adds a startup option for keeping settings and persistent app data in a directory on a USB drive or another user-selected location.

  • Accept --user-data-dir=<path> and --user-data-dir <path>; resolve relative paths against the launch working directory, create missing directories, and reject invalid or unwritable storage.
  • Use the selected directory for startup preferences, settings and AI session stores, attachments, themes, templates, document history, spellcheck dictionaries, logs, and window state.
  • Keep document/folder launch arguments working, reject forwarding an explicit different profile to an existing instance, and preserve the resolved directory after Windows portable updates.
  • Add English/Chinese usage examples and document profile migration and platform behavior.

Closes #755.

Validation

  • cargo test --lib --quiet: 313 tests passed.
  • cargo fmt --all --check: passed.
  • cargo build: passed on macOS.
  • pnpm --filter @markra/desktop test: 178 tests passed.
  • pnpm --filter @markra/desktop build: passed, including vendor chunk verification.
  • pnpm --filter @markra/desktop typecheck:test: passed.
  • Native macOS QA with an isolated app and synthetic data: relative and absolute directories, both parameter forms, settings writes, theme/session/log/window-state persistence, startup preference reads after restart, secondary-instance file opening, directory-conflict dialog, and malformed arguments.

Platform and migration notes

The existing system profile remains the default when the option is omitted. New directories start with independent settings; existing data is not moved automatically, and external document paths are not rewritten. Quit Markra completely before switching directories.

Windows/Linux webviews use the selected directory. macOS custom profiles use ephemeral WKWebView storage because arbitrary cache directories are unsupported; durable Markra data still uses native profile paths.

Windows/Linux native runtime QA has not been performed. The local Windows cross-compile attempt stopped before compilation because the offline cache lacked clipboard-win v5.4.1; the PR CI includes Windows test compilation and Linux/macOS tests.

@vercel

vercel Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
markra-web Ready Ready Preview Oct 11, 2026 9:37am UTC

@murongg
murongg merged commit fa3f9e9 into v2 Oct 11, 2026
23 checks passed
@murongg
murongg deleted the feature/755-user-data-dir branch October 11, 2026 10:20

This branch was successfully deployed

1 active deployment
Preview — bb8c8c9b Deployed Oct 11, 2026 by vercel[bot]
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.

[Feature]: 希望支持像obsidian一样支持通过命令行参数定义数据目录

1 participant