| 108 | } |
| 109 | |
| 110 | void 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 | |
| 135 | QString ScriptManager::getScriptPath() |