MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / copy

Class copy

launcher/FileSystem.h:105–157  ·  view source on GitHub ↗

* @brief Copies a directory and it's contents from src to dest */

Source from the content-addressed store, hash-verified

103 * @brief Copies a directory and it's contents from src to dest
104 */
105class copy : public QObject {
106 Q_OBJECT
107 public:
108 copy(const QString& src, const QString& dst, QObject* parent = nullptr) : QObject(parent)
109 {
110 m_src.setPath(src);
111 m_dst.setPath(dst);
112 }
113 copy& followSymlinks(const bool follow)
114 {
115 m_followSymlinks = follow;
116 return *this;
117 }
118 copy& matcher(const IPathMatcher* filter)
119 {
120 m_matcher = filter;
121 return *this;
122 }
123 copy& whitelist(bool whitelist)
124 {
125 m_whitelist = whitelist;
126 return *this;
127 }
128 copy& overwrite(const bool overwrite)
129 {
130 m_overwrite = overwrite;
131 return *this;
132 }
133
134 bool operator()(bool dryRun = false) { return operator()(QString(), dryRun); }
135
136 qsizetype totalCopied() { return m_copied; }
137 qsizetype totalFailed() { return m_failedPaths.length(); }
138 QStringList failed() { return m_failedPaths; }
139
140 signals:
141 void fileCopied(const QString& relativeName);
142 void copyFailed(const QString& relativeName);
143 // TODO: maybe add a "shouldCopy" signal in the future?
144
145 private:
146 bool operator()(const QString& offset, bool dryRun = false);
147
148 private:
149 bool m_followSymlinks = true;
150 const IPathMatcher* m_matcher = nullptr;
151 bool m_whitelist = false;
152 bool m_overwrite = false;
153 QDir m_src;
154 QDir m_dst;
155 qsizetype m_copied;
156 QStringList m_failedPaths;
157};
158
159struct LinkPair {
160 QString src;

Callers 15

operator()Method · 0.85
moveByCopyFunction · 0.85
overrideFolderFunction · 0.85
copyBlockedModsMethod · 0.85
INISettingsObjectMethod · 0.85
moveAndFinishUpdateMethod · 0.85
backupAppDirMethod · 0.85
SaveIconFunction · 0.85
installIconMethod · 0.85
installMethod · 0.85
replaceMethod · 0.85
installComponentsMethod · 0.85

Calls 2

QObjectClass · 0.85
setPathMethod · 0.45

Tested by

no test coverage detected