fix: add flag for testing plugins, don't load testing plugins if testing is disabled

This commit is contained in:
goat 2020-10-02 20:57:56 +02:00
parent 770363e2d2
commit e498da8079
2 changed files with 15 additions and 1 deletions

View file

@ -93,12 +93,18 @@ namespace Dalamud.Plugin
// If this entire folder has been marked as a disabled plugin, don't even try to load anything
var disabledFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, ".disabled"));
if (disabledFile.Exists && !raw) // should raw/dev plugins really not respect this?
if (disabledFile.Exists && !raw) // should raw/dev plugins really not respect this?
{
Log.Information("Plugin {0} is disabled.", dllFile.FullName);
return false;
}
var testingFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, ".testing"));
if (testingFile.Exists && this.dalamud.Configuration.DoPluginTest) {
Log.Information("Plugin {0} was testing, but testing is disabled.", dllFile.FullName);
return false;
}
// read the plugin def if present - again, fail before actually trying to load the dll if there is a problem
var defJsonFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, $"{Path.GetFileNameWithoutExtension(dllFile.Name)}.json"));

View file

@ -71,6 +71,7 @@ namespace Dalamud.Plugin
var outputDir = new DirectoryInfo(Path.Combine(this.pluginDirectory, definition.InternalName, definition.AssemblyVersion));
var dllFile = new FileInfo(Path.Combine(outputDir.FullName, $"{definition.InternalName}.dll"));
var disabledFile = new FileInfo(Path.Combine(outputDir.FullName, ".disabled"));
var testingFile = new FileInfo(Path.Combine(outputDir.FullName, ".testing"));
var wasDisabled = disabledFile.Exists;
if (dllFile.Exists && enableAfterInstall)
@ -118,6 +119,13 @@ namespace Dalamud.Plugin
return true;
}
if (doTestingDownload) {
testingFile.Create();
} else {
if (testingFile.Exists)
testingFile.Delete();
}
return this.dalamud.PluginManager.LoadPluginFromAssembly(dllFile, false, PluginLoadReason.Installer);
}
catch (Exception e)