mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
fix. 插件安装修复
This commit is contained in:
40
LanMountainDesktop.Tests/PluginRuntimeDataPathTests.cs
Normal file
40
LanMountainDesktop.Tests/PluginRuntimeDataPathTests.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using LanMountainDesktop.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace LanMountainDesktop.Tests;
|
||||
|
||||
public sealed class PluginRuntimeDataPathTests : IDisposable
|
||||
{
|
||||
private readonly string _dataRoot = Path.Combine(
|
||||
Path.GetTempPath(),
|
||||
"LanMountainDesktop.Tests",
|
||||
nameof(PluginRuntimeDataPathTests),
|
||||
Guid.NewGuid().ToString("N"));
|
||||
|
||||
[Fact]
|
||||
public void PluginRuntime_UsesHostDataRootForPluginsAndMarketData()
|
||||
{
|
||||
AppDataPathProvider.Initialize(["--data-root", _dataRoot]);
|
||||
|
||||
using var runtime = new PluginRuntimeService();
|
||||
|
||||
Assert.Equal(
|
||||
Path.Combine(Path.GetFullPath(_dataRoot), "Extensions", "Plugins"),
|
||||
runtime.PluginsDirectory);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppDataPathProvider.ResetForTests();
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(_dataRoot))
|
||||
{
|
||||
Directory.Delete(_dataRoot, recursive: true);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user