MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / extractGroup

Method extractGroup

src/data/AssetManager.cpp:14–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14int AssetManager::extractGroup(AssetType type, bool allowOverride)
15{
16 QString internalPath;
17 QString externalPath;
18 switch(type)
19 {
20 case AssetManager::AT_IR:
21 internalPath = ":/assets/irs";
22 externalPath = AppConfig::instance().getIrsPath();
23 break;
24 case AssetManager::AT_VDC:
25 internalPath = ":/assets/vdc";
26 externalPath = AppConfig::instance().getVdcPath();
27 break;
28 case AssetManager::AT_LIVEPROG:
29 internalPath = ":/assets/liveprog";
30 externalPath = AppConfig::instance().getLiveprogPath();
31 break;
32 }
33
34 if(!QDir(externalPath).exists())
35 {
36 QDir().mkpath(externalPath);
37 }
38
39 QDirIterator it(internalPath, QDirIterator::NoIteratorFlags);
40 int i = 0;
41 while (it.hasNext())
42 {
43 QFile sourceFile(it.next());
44 QFile targetFile(externalPath + QDir::separator() + QFileInfo(sourceFile).fileName());
45
46 if (targetFile.exists() && !allowOverride)
47 {
48 continue;
49 }
50 else if(targetFile.exists())
51 {
52 targetFile.remove();
53 }
54
55 sourceFile.copy(targetFile.fileName());
56 targetFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ReadGroup | QFileDevice::ReadOther);
57 i++;
58 }
59
60 if (i > 0)
61 {
62 Log::debug(QString("%1 assets extracted (type %2)").arg(i).arg(type));
63 }
64
65 return i;
66}
67
68int AssetManager::extractAll(bool force)
69{

Callers

nothing calls this directly

Calls 5

QStringClass · 0.50
existsMethod · 0.45
hasNextMethod · 0.45
removeMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected