From 5bb71e5ed76b2068ea53f0dcdc92c14bafb013a9 Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 9 Jul 2025 15:05:06 -0600 Subject: [PATCH 1/2] warning when plugin fails to install (#44) --- src/Update.as | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Update.as b/src/Update.as index ccb59f7..383bd62 100644 --- a/src/Update.as +++ b/src/Update.as @@ -35,6 +35,14 @@ void PluginInstallAsync(int siteID, const string &in identifier, const Version & yield(); } + if (!IO::FileExists(savePath) || IO::FileSize(savePath) == 0) { + const string msg = "There was an error installing the plugin '" + identifier + + ",' you should check your permissions! If you need help, you can join the Discord " + "through the menu at the top, " + Icons::QuestionCircle + " Help, " + Icons::DiscordAlt + " Join Discord"; + error(msg); + UI::ShowNotification(Icons::ShoppingCart + " Plugin Manager", msg, vec4(1.0f, 0.4f, 0.0f, 0.8f), 15000); + } + if (load) { // Load the plugin auto plugin = Meta::LoadPlugin(savePath, Meta::PluginSource::UserFolder, Meta::PluginType::Zip); From ce7c3cfb73005ed36d07a20f47e6840ec3d6c35c Mon Sep 17 00:00:00 2001 From: Ezio Date: Thu, 10 Jul 2025 18:06:49 -0600 Subject: [PATCH 2/2] add link to troubleshooting page --- src/Interface/Tabs/Plugin.as | 12 +++++++++++- src/Update.as | 18 ++++++++++++------ src/Utils/PluginInfo.as | 3 +++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Interface/Tabs/Plugin.as b/src/Interface/Tabs/Plugin.as index a512b66..88e1378 100644 --- a/src/Interface/Tabs/Plugin.as +++ b/src/Interface/Tabs/Plugin.as @@ -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(); @@ -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; } diff --git a/src/Update.as b/src/Update.as index 383bd62..b4e3cc3 100644 --- a/src/Update.as +++ b/src/Update.as @@ -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 + "\""); @@ -35,12 +35,16 @@ void PluginInstallAsync(int siteID, const string &in identifier, const Version & yield(); } - if (!IO::FileExists(savePath) || IO::FileSize(savePath) == 0) { - const string msg = "There was an error installing the plugin '" + identifier - + ",' you should check your permissions! If you need help, you can join the Discord " - "through the menu at the top, " + Icons::QuestionCircle + " Help, " + Icons::DiscordAlt + " Join Discord"; + 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), 15000); + 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) { @@ -54,6 +58,8 @@ void PluginInstallAsync(int siteID, const string &in identifier, const Version & PluginCache::SyncUnloaded(identifier, siteID, version); } } + + return true; } void PluginUpdateAsync(ref@ update) diff --git a/src/Utils/PluginInfo.as b/src/Utils/PluginInfo.as index 692ef60..33e5063 100644 --- a/src/Utils/PluginInfo.as +++ b/src/Utils/PluginInfo.as @@ -32,6 +32,7 @@ class PluginInfo array m_changelogs; bool m_isInstalled; + bool m_failedToInstall = false; Net::HttpRequest@ m_changelogRequest; @@ -102,6 +103,7 @@ class PluginInfo // If the plugin is loaded, it's installed if (GetInstalledPlugin() !is null) { m_isInstalled = true; + m_failedToInstall = false; return; } @@ -109,6 +111,7 @@ class PluginInfo string path = IO::FromDataFolder("Plugins/" + m_id + ".op"); if (IO::FileExists(path)) { m_isInstalled = true; + m_failedToInstall = false; return; } }