mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-17 05:31:01 +08:00
fix(Gallery): fix AppImage installer asset paths
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
<Version>__VERSION__</Version>
|
||||
<AppBundleIdentifier>net.atomui.gallery</AppBundleIdentifier>
|
||||
<Title>AtomUIGallery Installer</Title>
|
||||
<AppIcon>Assets/Images/icons</AppIcon>
|
||||
<AppIcon>Assets/Images/AppLogo.iconset</AppIcon>
|
||||
<Company>Qinware</Company>
|
||||
<CompanyFullName>Qinware Technology Co., Ltd.</CompanyFullName>
|
||||
<CompanyUrl>https://www.qinware.com</CompanyUrl>
|
||||
<Copyright>Copyright Qinware Technology Co., Ltd.</Copyright>
|
||||
<InstallerApplicationIcon>Assets/Images/AtomUIGallery.png</InstallerApplicationIcon>
|
||||
</Installer>
|
||||
<InstallerApplicationIcon>Assets/Images/AppLogo.iconset/icon_512x512.png</InstallerApplicationIcon>
|
||||
</Installer>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace AtomUIGallery.Tests.Workspace;
|
||||
|
||||
public class GalleryInstallerAssetTests
|
||||
{
|
||||
[Fact]
|
||||
public void AppImage_Config_References_Existing_Installer_Assets()
|
||||
{
|
||||
var desktopProjectPath = GetRepoDirectory("controlgallery/AtomUIGallery.Desktop");
|
||||
var configPath = Path.Combine(desktopProjectPath, "configs/InstallerConfig.appimage.xml");
|
||||
var config = XDocument.Load(configPath);
|
||||
|
||||
var appIcon = ReadRequiredElement(config, "AppIcon");
|
||||
var appIconPath = Path.Combine(desktopProjectPath, appIcon);
|
||||
Directory.Exists(appIconPath).ShouldBeTrue($"Missing AppImage AppIcon directory: {appIconPath}");
|
||||
|
||||
var installerApplicationIcon = ReadRequiredElement(config, "InstallerApplicationIcon");
|
||||
var installerIconPath = Path.Combine(desktopProjectPath, installerApplicationIcon);
|
||||
File.Exists(installerIconPath).ShouldBeTrue($"Missing AppImage InstallerApplicationIcon file: {installerIconPath}");
|
||||
}
|
||||
|
||||
private static string ReadRequiredElement(XDocument document, string elementName)
|
||||
{
|
||||
var value = document.Root?.Elements(elementName).SingleOrDefault()?.Value;
|
||||
value.ShouldNotBeNullOrWhiteSpace();
|
||||
return value;
|
||||
}
|
||||
|
||||
private static string GetRepoDirectory(string relativePath)
|
||||
{
|
||||
var directory = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (directory is not null)
|
||||
{
|
||||
var candidate = Path.Combine(directory.FullName, relativePath);
|
||||
if (Directory.Exists(candidate))
|
||||
{
|
||||
return candidate;
|
||||
}
|
||||
|
||||
directory = directory.Parent;
|
||||
}
|
||||
|
||||
throw new DirectoryNotFoundException($"Could not find repository directory: {relativePath}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user