MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / createOverrides

Function createOverrides

launcher/modplatform/helpers/OverrideUtils.cpp:9–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace Override {
8
9void createOverrides(const QString& name, const QString& parent_folder, const QString& override_path)
10{
11 QString file_path(FS::PathCombine(parent_folder, name + ".txt"));
12 if (QFile::exists(file_path))
13 QFile::remove(file_path);
14
15 FS::ensureFilePathExists(file_path);
16
17 QFile file(file_path);
18 file.open(QFile::WriteOnly);
19
20 QDirIterator override_iterator(override_path, QDirIterator::Subdirectories);
21 while (override_iterator.hasNext()) {
22 auto override_file_path = override_iterator.next();
23 QFileInfo info(override_file_path);
24 if (info.isFile()) {
25 // Absolute path with temp directory -> relative path
26 override_file_path = override_file_path.split(name).last().remove(0, 1);
27
28 file.write(override_file_path.toUtf8());
29 file.write("\n");
30 }
31 }
32
33 file.close();
34}
35
36QStringList readOverrides(const QString& name, const QString& parent_folder)
37{

Callers 2

createInstanceMethod · 0.85
createInstanceMethod · 0.85

Calls 6

PathCombineFunction · 0.85
ensureFilePathExistsFunction · 0.85
openMethod · 0.80
nextMethod · 0.80
removeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected