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/FileSystem.h | |
parent | 4fbcb3efb90368c084946600afdca05ca7c65519 (diff) | |
download | PrismLauncher-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar.gz PrismLauncher-44db72ead568fe7ce22e1999aac02fd9aac9beea.tar.bz2 PrismLauncher-44db72ead568fe7ce22e1999aac02fd9aac9beea.zip |
GH-93 add an option to not copy saves on instance copy
Diffstat (limited to 'logic/FileSystem.h')
-rw-r--r-- | logic/FileSystem.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/logic/FileSystem.h b/logic/FileSystem.h index 5055eb6c..5e21375b 100644 --- a/logic/FileSystem.h +++ b/logic/FileSystem.h @@ -3,9 +3,11 @@ #pragma once #include "Exception.h" +#include "pathmatcher/IPathMatcher.h" #include "multimc_logic_export.h" #include <QDir> +#include <QFlags> namespace FS { @@ -38,10 +40,39 @@ MULTIMC_LOGIC_EXPORT bool ensureFilePathExists(QString filenamepath); */ MULTIMC_LOGIC_EXPORT bool ensureFolderPathExists(QString filenamepath); -/** - * Copy a folder recursively - */ -MULTIMC_LOGIC_EXPORT bool copyPath(const QString &src, const QString &dst, bool follow_symlinks = true); +class MULTIMC_LOGIC_EXPORT copy +{ +public: + copy(const copy&) = delete; + copy(const QString & src, const QString & dst) + { + m_src = src; + m_dst = dst; + } + copy & followSymlinks(const bool follow) + { + m_followSymlinks = follow; + return *this; + } + copy & blacklist(const IPathMatcher * filter) + { + m_blacklist = filter; + return *this; + } + bool operator()() + { + return operator()(QString()); + } + +private: + bool operator()(const QString &offset); + +private: + bool m_followSymlinks = true; + const IPathMatcher * m_blacklist = nullptr; + QDir m_src; + QDir m_dst; +}; /** * Delete a folder recursively |