Repository navigation
设置页可以更换数据目录,并在校验通过后迁移 - #132
Merged
Merged
Conversation
选择新文件夹后先复制导出白名单里的文件并逐个校验,通过才写引导文件并让已打开的存储改指新目录。失败时仍用旧目录,旧目录不删除,目标里已有数据则不合并。 Co-authored-by: Wynn <wynn0921@qq.com>
todo-purge-pending.json 和清单、收纳分组在同一把写锁里一起复制,并列入字节一致才补写引导文件的比较。字节不同则拒绝,不覆盖目标里的记录。 Co-authored-by: Wynn <wynn0921@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #121
设置 → 数据里的「更换」打开系统文件夹对话框。选中后暂停写入,按导出白名单把现有数据复制到新目录并逐个校验。校验通过才写
%LOCALAPPDATA%\Lanwork\bootstrap.json,然后让已打开的存储改指新目录。界面在这之前仍显示原来的路径。失败时仍用原来的目录,并在面板底部显示错误。旧目录不自动删除。新目录里已经有 Lanwork 数据时不合并、不迁移、不删除那边的文件。目标不可写、不是文件夹、与当前目录相同或互相包含、落在 MayDolist、空间不足,或当前目录还有
import.pending,都不切换。复制的文件以导出白名单为底:
config.json、user-apps.json、todo-float.json,以及todos/、notes/、shelves/里的清单。文件存在时再加上todo-purge-pending.json。永久删除先写这份记录,再写清单;收纳解除是另一次写锁。迁移在同一把写锁里拍下这三份,记录跟着走,下次启动才能补上解除。它不进入导出包。不复制reminder-sent.json、import.pending、logs/、backups/、cache/web-icons/、github/和*.corrupt-*。待定
这些不是产品规格里写死的,架构文档里标了待定:
LANWORK_DATA_DIR非空时设置里拒绝更换。改了引导文件下次启动也不会换目录。todo-purge-pending.json)若与当前目录路径和字节完全一致,只补写引导文件并切换。这是上次复制完成、引导文件还没写成的情况,不是合并两份不同的数据。字节不同则拒绝,不覆盖。config.json的dataDir原样复制,不改写。启动不读这个字段。logs/app.log。网站图标缓存仍用旧目录的cache/web-icons/,下次启动可以重建。测试
lanwork_core::backup::migrate覆盖成功切换、迁移期间的写入进新目录、复制中断后旧目录仍在且半份目标不能当空目录再用、校验失败删掉这次写下的文件、引导文件没写成时下次可以补上、已有不同数据不删除、空间不足、环境变量、相同目录、嵌套、MayDolist、import.pending、目标是文件。清除记录和当时的清单、收纳分组一起复制;目标里这份记录字节不同则拒绝且不覆盖,字节一致时可以补写引导文件。导出白名单与package::list_data_files对齐,不含reminder-sent.json,也不含清除记录。设置页布局测试点「更换」,路径不自己变,按钮禁用后不再发出请求。没有 Windows 上的手测记录,不宣称迁移已在 Windows 上验收。