Skip to content

Commit e6ebc2d

Browse files
EmoSaruclaude
andcommitted
Remove #if WINDOWS blocks and fix PortAudio CI bundling
- Remove all #if WINDOWS conditional compilation blocks from App.axaml.cs: ConfigurePlatformDllPaths/SetDllDirectory call, Discord RPC teardown, and the SetDllDirectory P/Invoke declaration - Drop unused System.Runtime.InteropServices using directive - Place bundled portaudio.dll alongside the executable in CI output rather than in a runtimes subdirectory Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 28749be commit e6ebc2d

3 files changed

Lines changed: 2 additions & 38 deletions

File tree

.github/workflows/build-avalonia.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ jobs:
6363
if: startsWith(matrix.rid, 'win')
6464
shell: bash
6565
run: |
66-
mkdir -p publish/raw/runtimes/win-x64/native
6766
curl -fsSL "https://github.com/spatialaudio/portaudio-binaries/raw/master/libportaudio64bit.dll" \
68-
-o "publish/raw/runtimes/win-x64/native/portaudio.dll"
67+
-o "publish/raw/portaudio.dll"
6968
7069
- name: Stage Windows output
7170
if: startsWith(matrix.rid, 'win')

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ jobs:
3737
- name: Bundle PortAudio for Windows
3838
shell: bash
3939
run: |
40-
mkdir -p publish/win-x64/runtimes/win-x64/native
4140
curl -fsSL "https://github.com/spatialaudio/portaudio-binaries/raw/master/libportaudio64bit.dll" \
42-
-o "publish/win-x64/runtimes/win-x64/native/portaudio.dll"
41+
-o "publish/win-x64/portaudio.dll"
4342
4443
- name: Publish osx-x64
4544
run: dotnet publish EmoTracker/EmoTracker.csproj --framework net8.0 --configuration Release --runtime osx-x64 --self-contained --output publish/osx-x64

EmoTracker/App.axaml.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Serilog.Events;
99
using System;
1010
using System.IO;
11-
using System.Runtime.InteropServices;
1211

1312
namespace EmoTracker
1413
{
@@ -21,10 +20,6 @@ public override void Initialize()
2120

2221
public override void OnFrameworkInitializationCompleted()
2322
{
24-
#if WINDOWS
25-
ConfigurePlatformDllPaths();
26-
#endif
27-
2823
Data.Core.Transactions.TransactionProcessor.SetTransactionProcessor(
2924
new Data.Core.Transactions.Processors.LocalTransactionProcessorWithUndo());
3025

@@ -67,14 +62,6 @@ public override void OnFrameworkInitializationCompleted()
6762

6863
if (e.ApplicationExitCode == 0)
6964
Extensions.ExtensionManager.Instance.OnApplicationClosing();
70-
71-
#if WINDOWS
72-
if (Data.ApplicationSettings.Instance.EnableDiscordRichPresence)
73-
{
74-
try { DiscordRpc.ClearPresence(); DiscordRpc.Shutdown(); }
75-
catch { }
76-
}
77-
#endif
7865
}
7966
catch { }
8067
finally
@@ -87,26 +74,5 @@ public override void OnFrameworkInitializationCompleted()
8774
base.OnFrameworkInitializationCompleted();
8875
}
8976

90-
#if WINDOWS
91-
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
92-
[return: MarshalAs(UnmanagedType.Bool)]
93-
private static extern bool SetDllDirectory(string lpPathName);
94-
95-
private static void ConfigurePlatformDllPaths()
96-
{
97-
try
98-
{
99-
string processorAssemblyPath = Environment.Is64BitProcess ? "x64" : "x86";
100-
string privateBinPath = Path.Combine(
101-
AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
102-
processorAssemblyPath + "\\");
103-
SetDllDirectory(privateBinPath);
104-
}
105-
catch
106-
{
107-
throw new InvalidOperationException("Failed to set platform DLL search directory.");
108-
}
109-
}
110-
#endif
11177
}
11278
}

0 commit comments

Comments
 (0)