Run input plugins before deploying icons and desktop files

The input plugins might even fetch these resources somewhere into the
AppDir, and this way, the user can make use of that.
This commit is contained in:
TheAssassin
2018-08-28 23:05:45 +02:00
parent c4167165ad
commit b550e4da21

View File

@@ -140,6 +140,40 @@ int main(int argc, char** argv) {
}
}
// run input plugins before deploying icons and desktop files
// the input plugins might even fetch these resources somewhere into the AppDir, and this way, the user can make use of that
if (inputPlugins) {
for (const auto& pluginName : inputPlugins.Get()) {
auto it = foundPlugins.find(std::string(pluginName));
ldLog() << std::endl << "-- Running input plugin:" << pluginName << "--" << std::endl;
if (it == foundPlugins.end()) {
ldLog() << LD_ERROR << "Could not find plugin:" << pluginName;
return 1;
}
auto plugin = it->second;
if (plugin->pluginType() != linuxdeploy::plugin::INPUT_TYPE) {
if (plugin->pluginType() == linuxdeploy::plugin::OUTPUT_TYPE) {
ldLog() << LD_ERROR << "Plugin" << pluginName << "is an output plugin, please use like --output" << pluginName << std::endl;
} else {
ldLog() << LD_ERROR << "Plugin" << pluginName << "has unkown type:" << plugin->pluginType() << std::endl;
}
return 1;
}
auto retcode = plugin->run(appDir.path());
if (retcode != 0) {
ldLog() << LD_ERROR << "Failed to run plugin:" << pluginName << std::endl;
ldLog() << LD_DEBUG << "Exited with return code:" << retcode << std::endl;
return 1;
}
}
}
if (iconPaths) {
ldLog() << std::endl << "-- Deploying icons --" << std::endl;
@@ -210,38 +244,6 @@ int main(int argc, char** argv) {
}
}
if (inputPlugins) {
for (const auto& pluginName : inputPlugins.Get()) {
auto it = foundPlugins.find(std::string(pluginName));
ldLog() << std::endl << "-- Running input plugin:" << pluginName << "--" << std::endl;
if (it == foundPlugins.end()) {
ldLog() << LD_ERROR << "Could not find plugin:" << pluginName;
return 1;
}
auto plugin = it->second;
if (plugin->pluginType() != linuxdeploy::plugin::INPUT_TYPE) {
if (plugin->pluginType() == linuxdeploy::plugin::OUTPUT_TYPE) {
ldLog() << LD_ERROR << "Plugin" << pluginName << "is an output plugin, please use like --output" << pluginName << std::endl;
} else {
ldLog() << LD_ERROR << "Plugin" << pluginName << "has unkown type:" << plugin->pluginType() << std::endl;
}
return 1;
}
auto retcode = plugin->run(appDir.path());
if (retcode != 0) {
ldLog() << LD_ERROR << "Failed to run plugin:" << pluginName << std::endl;
ldLog() << LD_DEBUG << "Exited with return code:" << retcode << std::endl;
return 1;
}
}
}
// search for desktop file and deploy it to AppDir root
{
ldLog() << std::endl << "-- Deploying files into AppDir root directory --" << std::endl;