Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Interface/Tabs/Plugin.as
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PluginTab : Tab
{
m_updating = true;

PluginInstallAsync(m_plugin.m_siteID, m_plugin.m_id, m_plugin.m_version);
m_plugin.m_failedToInstall = !PluginInstallAsync(m_plugin.m_siteID, m_plugin.m_id, m_plugin.m_version);

m_plugin.m_downloads++;
m_plugin.CheckIfInstalled();
Expand Down Expand Up @@ -190,6 +190,16 @@ class PluginTab : Tab
if (UI::GreenButton(Icons::Download + " Install")) {
startnew(CoroutineFunc(InstallAsync));
}

if (m_plugin.m_failedToInstall) {
const string helpLink = "https://openplanet.dev/docs/help";
UI::SameLine();
if (UI::RedButton(Icons::QuestionCircle + " Troubleshooting")) {
OpenBrowserURL(helpLink);
}
UI::SetItemTooltip(helpLink);
}

return;
}

Expand Down
16 changes: 15 additions & 1 deletion src/Update.as
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void PluginUninstallAsync(ref@ metaPlugin)
PluginCache::SyncRemove(pluginIdentifier);
}

void PluginInstallAsync(int siteID, const string &in identifier, const Version &in version, bool load = true)
bool PluginInstallAsync(int siteID, const string &in identifier, const Version &in version, bool load = true)
{
warn("Installing plugin with site ID " + siteID + " and identifier \"" + identifier + "\"");

Expand All @@ -35,6 +35,18 @@ void PluginInstallAsync(int siteID, const string &in identifier, const Version &
yield();
}

if (IO::FileSize(savePath) == 0) {
const string msg = "Error installing plugin '" + identifier + "' ";
error(msg);
UI::ShowNotification(Icons::ShoppingCart + " Plugin Manager", msg, vec4(1.0f, 0.4f, 0.0f, 0.8f), 10000);

if (IO::FileExists(savePath)) {
IO::Delete(savePath);
}

return false;
}

if (load) {
// Load the plugin
auto plugin = Meta::LoadPlugin(savePath, Meta::PluginSource::UserFolder, Meta::PluginType::Zip);
Expand All @@ -46,6 +58,8 @@ void PluginInstallAsync(int siteID, const string &in identifier, const Version &
PluginCache::SyncUnloaded(identifier, siteID, version);
}
}

return true;
}

void PluginUpdateAsync(ref@ update)
Expand Down
3 changes: 3 additions & 0 deletions src/Utils/PluginInfo.as
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PluginInfo
array<PluginChangelog@> m_changelogs;

bool m_isInstalled;
bool m_failedToInstall = false;

Net::HttpRequest@ m_changelogRequest;

Expand Down Expand Up @@ -102,13 +103,15 @@ class PluginInfo
// If the plugin is loaded, it's installed
if (GetInstalledPlugin() !is null) {
m_isInstalled = true;
m_failedToInstall = false;
return;
}

// If the file exists in the plugin folder, it's installed
string path = IO::FromDataFolder("Plugins/" + m_id + ".op");
if (IO::FileExists(path)) {
m_isInstalled = true;
m_failedToInstall = false;
return;
}
}
Expand Down