From bee75803f7932eec5ee295d969a2cde8a3aea51d Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 6 Oct 2017 11:51:27 +1100 Subject: [PATCH] Adds file exist checks --- src/Umbraco.Core/PluginManager.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index b6a72f74cf..9bcca8982a 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -82,21 +82,23 @@ namespace Umbraco.Core RequiresRescanning = (CachedAssembliesHash != CurrentAssembliesHash) || CachedAssembliesHash == string.Empty; //if they have changed, we need to write the new file if (RequiresRescanning) - { - // if the hash has changed, clear out the persisted list no matter what, this will force - // rescanning of all plugin types including lazy ones. - // http://issues.umbraco.org/issue/U4-4789 - File.Delete(pluginListFile); + { + // if the hash has changed, clear out the persisted list no matter what, this will force + // rescanning of all plugin types including lazy ones. + // http://issues.umbraco.org/issue/U4-4789 + if(File.Exists(pluginListFile)) + File.Delete(pluginListFile); WriteCachePluginsHash(); } } else - { - // if the hash has changed, clear out the persisted list no matter what, this will force - // rescanning of all plugin types including lazy ones. + { + // if the hash has changed, clear out the persisted list no matter what, this will force + // rescanning of all plugin types including lazy ones. // http://issues.umbraco.org/issue/U4-4789 - File.Delete(pluginListFile); + if (File.Exists(pluginListFile)) + File.Delete(pluginListFile); // always set to true if we're not detecting (generally only for testing) RequiresRescanning = true;