MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DirectoryCopyHelper

Method DirectoryCopyHelper

Source/Engine/Platform/Base/FileSystemBase.cpp:281–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281bool FileSystemBase::DirectoryCopyHelper(const String& dst, const String& src, bool withSubDirectories)
282{
283 // Create dst directory
284 if (!FileSystem::DirectoryExists(dst))
285 {
286 if (FileSystem::CreateDirectory(dst))
287 return true;
288 }
289
290 // Copy all files
291 Array<String> cache(32);
292 if (FileSystem::DirectoryGetFiles(cache, *src, TEXT("*"), DirectorySearchOption::TopDirectoryOnly))
293 return true;
294 for (int32 i = 0; i < cache.Count(); i++)
295 {
296 String dstFile = dst / StringUtils::GetFileName(cache[i]);
297 if (FileSystem::CopyFile(*dstFile, *cache[i]))
298 return true;
299 }
300
301 // Copy all subdirectories (if need to)
302 if (withSubDirectories)
303 {
304 cache.Clear();
305 if (FileSystem::GetChildDirectories(cache, src))
306 return true;
307 for (int32 i = 0; i < cache.Count(); i++)
308 {
309 String dstDir = dst / StringUtils::GetFileName(cache[i]);
310 if (DirectoryCopyHelper(dstDir, cache[i], true))
311 return true;
312 }
313 }
314
315 return false;
316}
317
318bool FileSystemBase::PathFilterHelper(const char* path, const char* searchPattern)
319{

Callers

nothing calls this directly

Calls 2

CountMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected