Skip to content

Resolve portable mode detection and handling - #2340

Open
Spr-Aachen wants to merge 2 commits into
chen08209:mainfrom
Spr-Aachen:dev
Open

Resolve portable mode detection and handling#2340
Spr-Aachen wants to merge 2 commits into
chen08209:mainfrom
Spr-Aachen:dev

Conversation

@Spr-Aachen

@Spr-Aachen Spr-Aachen commented Aug 19, 2026

Copy link
Copy Markdown

This PR provides the final solution for portable mode detection and handling inspired by Visual Studio Code's portable design.

Features:

  • Data lives next to the executable (config/ beside FlClash.exe, like VS Code's data/)
  • Presence of the folder activates portable mode (isPortable = true if config/ exists, so portable mode can be activated/deactivated via creating/removing the config/ folder)
  • One-time migration from an existing install (%APPDATA%/com.follow/clash → portable config/) with improvement over VS Code: migration only copies missing files/dirs, never overwrites existing portable data.
  • tmp/ folder next to the app redirects the temp directory (same trick as VS Code)
  • Keep the config/ folder while upgrading

All features have been tested to work properly. You can download the release from here to give it a try.


Issues that can be resolved: #1882 #1228

- Refactor path and preferences handling
- Add portable mode detection and migration
Comment thread lib/common/path.dart Outdated

@Spr-Aachen Spr-Aachen left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改平台判断方式,包括 preference.dart 里的

@Spr-Aachen

Copy link
Copy Markdown
Author

已更新 release,可以直接下载体验效果,便携模式在存在 config/ 文件夹时即可生效

@Spr-Aachen
Spr-Aachen requested a review from chenx-dust August 26, 2026 10:46
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.

[BUG] Windows portable 版本配置文件未真正便携,路径不可切换

2 participants