forked from qt-creator/qt-creator
ExtensionSystem: Allow updating and removing plugins
Change-Id: Ie81e697c97fbfe0dc66346f42d467e1a697606c3 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -416,9 +416,25 @@ public:
|
||||
FilePaths folders = path.dirEntries(FileFilter({}, QDir::Dirs | QDir::NoDotAndDotDot));
|
||||
|
||||
for (const FilePath &folder : folders) {
|
||||
const FilePath script = folder / (folder.baseName() + ".lua");
|
||||
if (!script.exists())
|
||||
FilePath script = folder / (folder.baseName() + ".lua");
|
||||
if (!script.exists()) {
|
||||
FilePaths contents = folder.dirEntries(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
if (contents.empty())
|
||||
continue;
|
||||
|
||||
for (const FilePath &subfolder : contents) {
|
||||
script = subfolder / (subfolder.baseName() + ".lua");
|
||||
if (!script.exists()) {
|
||||
script.clear();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const expected_str<LuaPluginSpec *> result = loadPlugin(script);
|
||||
|
||||
@@ -430,6 +446,19 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PluginManager::takePluginIdForRemoval((*result)->id())) {
|
||||
auto removeResult = (*result)->removePluginFiles();
|
||||
if (!removeResult) {
|
||||
qWarning() << "Failed to remove plugin files" << script << ":"
|
||||
<< removeResult.error();
|
||||
MessageManager::writeFlashing(
|
||||
Tr::tr("Failed to remove plugin files of %1: %2")
|
||||
.arg((*result)->id())
|
||||
.arg(removeResult.error()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
plugins.insert(*result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user