MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / deleteScript

Method deleteScript

Extension/Script/scriptmanager.cpp:110–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void ScriptManager::deleteScript(const QString &id)
111{
112 QString path;
113 if(id2scriptHash.contains(id))
114 {
115 auto script = id2scriptHash.value(id);
116 path = script->getValue("path");
117 if(script->type()!=ScriptType::UNKNOWN_STYPE)
118 {
119 scriptLists[script->type()].removeAll(script);
120 id2scriptHash.remove(id);
121 emit scriptChanged(script->type());
122 }
123 }
124 if(!path.isEmpty())
125 {
126 QFileInfo fi(path);
127 fi.dir().remove(fi.fileName());
128 int suffixPos = path.lastIndexOf('.');
129 QFileInfo settingFile(path.mid(0,suffixPos)+".json");
130 if(settingFile.exists()) settingFile.dir().remove(settingFile.fileName());
131 }
132}
133
134
135QString ScriptManager::getScriptPath()

Callers 1

ScriptPageMethod · 0.80

Calls 8

valueMethod · 0.80
dirMethod · 0.80
existsMethod · 0.80
containsMethod · 0.45
getValueMethod · 0.45
typeMethod · 0.45
removeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected