Fix #3218: 修复复制游戏版本里的“复制存档”选项失效问题#3868
Conversation
|
跟PR #3843 是一样的更改, |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #3218 by ensuring the "复制存档" option works as intended during version duplication. It adds blacklist filtering for specific files and folders (like saves), changes file operations for .jar and .json files from move to copy, and removes a redundant blacklist initialization block.
| if (Files.exists(dstDir)) throw new IOException("Version exists"); | ||
| FileUtils.copyDirectory(srcDir, dstDir); | ||
| FileUtils.copyDirectory(srcDir, dstDir, path -> Modpack.acceptFile(path, blackList, null)); | ||
|
|
There was a problem hiding this comment.
[nitpick] Consider adding a comment explaining why the source files (.jar, .json) are now resolved from srcDir instead of dstDir after copying the directory.
| // Resolve the .json and .jar files from srcDir instead of dstDir to ensure they are explicitly copied | |
| // and updated correctly, as FileUtils.copyDirectory may not handle these files in the same way. |
|
|
||
| if (Files.exists(fromJar)) { | ||
| Files.move(fromJar, toJar); | ||
| Files.copy(fromJar, toJar); | ||
| } |
There was a problem hiding this comment.
[nitpick] Consider adding a clarifying comment on the decision to use Files.copy instead of Files.move for the .jar and .json files, confirming that preserving the originals is intentional.
Fix #3218
在复制version文件夹前补上了黑名单筛选的操作
以确保在选项开启后,存档文件夹不会被复制到新游戏版本