Skip to content

Commit

Permalink
[AOT] Clean up AOT build issue in Common.UI (#36376)
Browse files Browse the repository at this point in the history
* init commit

* Use path.combine

* Add useWPF and useWindowsForms back

---------

Co-authored-by: Yu Leng (from Dev Box) <[email protected]>
  • Loading branch information
moooyo and Yu Leng (from Dev Box) authored Feb 24, 2025
1 parent f81f65d commit 5cc30df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/common/Common.UI/Common.UI.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- Look at Directory.Build.props in root for common stuff as well -->
<Import Project="..\..\Common.Dotnet.CsWinRT.props" />
<Import Project="..\..\Common.Dotnet.AotCompatibility.props" />

<PropertyGroup>
<UseWPF>true</UseWPF>
Expand Down
10 changes: 5 additions & 5 deletions src/common/Common.UI/SettingsDeepLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ public static void OpenSettings(SettingsWindow window, bool mainExecutableIsOnTh
{
try
{
var assemblyPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var fullPath = new DirectoryInfo(assemblyPath).FullName;
var directoryPath = System.AppContext.BaseDirectory;
if (mainExecutableIsOnTheParentFolder)
{
// Need to go into parent folder for PowerToys.exe. Likely a WinUI3 App SDK application.
fullPath = fullPath + "\\..\\PowerToys.exe";
directoryPath = Path.Combine(directoryPath, "..");
directoryPath = Path.Combine(directoryPath, "PowerToys.exe");
}
else
{
// PowerToys.exe is in the same path as the application.
fullPath = fullPath + "\\PowerToys.exe";
directoryPath = Path.Combine(directoryPath, "PowerToys.exe");
}

Process.Start(new ProcessStartInfo(fullPath) { Arguments = "--open-settings=" + SettingsWindowNameToString(window) });
Process.Start(new ProcessStartInfo(directoryPath) { Arguments = "--open-settings=" + SettingsWindowNameToString(window) });
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/Common.UI/ThemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Common.UI
{
public class ThemeManager : IDisposable
public partial class ThemeManager : IDisposable
{
private readonly Application _app;
private const string LightTheme = "Light.Accent1";
Expand Down

0 comments on commit 5cc30df

Please sign in to comment.