Skip to content

Portable fix#1886

Open
SteveZMTstudios wants to merge 3 commits intochen08209:mainfrom
SteveZMTstudios:portable-fix
Open

Portable fix#1886
SteveZMTstudios wants to merge 3 commits intochen08209:mainfrom
SteveZMTstudios:portable-fix

Conversation

@SteveZMTstudios
Copy link

正在尝试修复 #1882

此拉取请求更新了 lib/common/path.dart 中的 AppPath 类,为桌面平台添加了便携模式支持。现在,如果可执行文件旁存在一个 config 目录,应用程序将使用该目录作为数据目录,而不是默认的平台特定位置。

便携模式支持:

  • 添加了 isPortable 标志,用于指示应用程序是否以便携模式运行。
  • 引入了 _initDataDir 方法,用于在桌面平台(Windows、macOS、Linux)上检查可执行文件旁是否存在 config 目录。如果找到,应用程序将使用该目录作为数据目录,并将 isPortable 设置为 true;否则,将回退到标准的应用程序支持目录。

仍在测试。

Copilot AI and others added 3 commits March 13, 2026 06:01
… data directory

Co-authored-by: SteveZMTstudios <98326195+SteveZMTstudios@users.noreply.github.com>
Implement portable mode via `./config` directory detection
@HaoTian22
Copy link

参照其他 App 设计的话最好在打包 Portable Version 的时候在目录下写一个文件表明是 Portable
(当然你这个想法写个 config dir 也可以,至少得修改一下打包流程)

@SteveZMTstudios
Copy link
Author

SteveZMTstudios commented Mar 21, 2026

flclash在打出release的时候有portable版本。我加这个主要是因为那个portable的版本也会把用户数据存储到c盘里面,不好随着u盘移动
至于config文件夹,我看Vs Code的portable也是要用户新建data文件夹才会把数据存储到可执行文件的位置。

@SteveZMTstudios SteveZMTstudios changed the title [WIP] Portable fix Portable fix Mar 21, 2026
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.

3 participants