1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include "fsCFileListBuilder.h"

#include <algorithm>
#include <raylib.h>

#include "../../src/fsCResourceName.h"


void fsCFileListBuilder::folderParse(const fsCResourceName& pFolder, fsBool pRecurse)
{
#if defined fsDesktop
	FilePathList files =  LoadDirectoryFiles(pFolder.nameGet().utf8Get());
	std::vector<std::string> dirFiles(files.paths, files.paths + files.count);
#else
    std::vector<std::string> files;<--- Unused variable: files
#endif

	std::for_each(dirFiles.begin(), dirFiles.end(), [this](std::string& filename)<--- Parameter 'filename' can be declared as reference to const
	{
		const fsBool folder = filename[filename.length() - 1] == '/';
		fsStr path(filename.c_str());
		fsStr fName(filename.c_str());
		if (folder)
		{
			path.erase(path.dataSizeGet() - 1);
			fName.erase(fName.dataSizeGet() - 1);
		}
		path.erase(path.rfind('/') + 1);
		fName.erase(0, fName.rfind('/') + 1);
		if (fName != "." && fName != "..")
		{
			entryAdd(path, fName, folder);
		}
	});
}

fsCFileListBuilder::fsCFileListBuilder(fsFileList& pList, const fsStr& pMatch) :
	fsIFileListBuilder(pList, pMatch)
{
}

fsCFileListBuilder::~fsCFileListBuilder()
{
}