diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-10-10 05:55:55 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-10-10 05:55:55 +0200 |
commit | 44db72ead568fe7ce22e1999aac02fd9aac9beea (patch) | |
tree | b03d7fa01a0b2ef772c2770e2db99bc8aa69c768 /logic/InstanceList.cpp | |
parent | 4fbcb3efb90368c084946600afdca05ca7c65519 (diff) | |
download | MultiMC-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar MultiMC-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar.gz MultiMC-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar.lz MultiMC-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar.xz MultiMC-44db72ead568fe7ce22e1999aac02fd9aac9beea.zip |
GH-93 add an option to not copy saves on instance copy
Diffstat (limited to 'logic/InstanceList.cpp')
-rw-r--r-- | logic/InstanceList.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index b791cc32..a8acdf05 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -38,6 +38,7 @@ #include "ftb/FTBPlugin.h" #include "NullInstance.h" #include "FileSystem.h" +#include "pathmatcher/RegexpMatcher.h" const static int GROUP_FILE_FORMAT_VERSION = 1; @@ -486,9 +487,18 @@ InstanceList::InstCreateError InstanceList::copyInstance(InstancePtr &newInstance, InstancePtr &oldInstance, const QString &instDir, bool copySaves) { QDir rootDir(instDir); + std::unique_ptr<IPathMatcher> matcher; + if(!copySaves) + { + auto matcherReal = new RegexpMatcher("[.]?minecraft/saves"); + matcherReal->caseSensitive(false); + matcher.reset(matcherReal); + } qDebug() << instDir.toUtf8(); - if (!FS::copyPath(oldInstance->instanceRoot(), instDir, false)) + FS::copy folderCopy(oldInstance->instanceRoot(), instDir); + folderCopy.followSymlinks(false).blacklist(matcher.get()); + if (!folderCopy()) { FS::deletePath(instDir); return InstanceList::CantCreateDir; |