Skip to content

Commit

Permalink
fix: copy resources after build or publish
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYunPlayer committed Jul 20, 2024
1 parent c56b61a commit cdb8ab6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
5 changes: 0 additions & 5 deletions TuneLab/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public override void OnFrameworkInitializationCompleted()
AudioEngine.Destroy();
};

// init translation
TranslationManager.Init(PathManager.TranslationsFolder);
TranslationManager.CurrentLanguage.Value = TranslationManager.Languages.Contains(Settings.Language.Value) ? Settings.Language : TranslationManager.GetCurrentOSLanguage();
Settings.Language.Modified.Subscribe(() => TranslationManager.CurrentLanguage.Value = Settings.Language);

// init audio engine
AudioUtils.Init(new NAudioCodec());
AudioEngine.Init(new SDLPlaybackHandler());
Expand Down
12 changes: 12 additions & 0 deletions TuneLab/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Avalonia;
using Avalonia.Media;
using Avalonia.ReactiveUI;
using TuneLab.Base.Utils;
using TuneLab.Configs;
using TuneLab.I18N;
using TuneLab.Utils;

namespace TuneLab;
Expand All @@ -18,9 +20,11 @@ class Program
[STAThread]
public static void Main(string[] args)
{
// init logger
Log.SetupLogger(new FileLogger(Path.Combine(PathManager.LogsFolder, "TuneLab_" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + ".log")));
Log.Info("Version: " + AppInfo.Version);

// check if other instance is running
var lockFile = LockFile.Create(PathManager.LockFilePath);
if (lockFile == null)
{
Expand All @@ -30,11 +34,19 @@ public static void Main(string[] args)
return;
}

// init setting
Settings.Init(PathManager.SettingsFilePath);

// init translation
TranslationManager.Init(PathManager.TranslationsFolder);
TranslationManager.CurrentLanguage.Value = TranslationManager.Languages.Contains(Settings.Language.Value) ? Settings.Language : TranslationManager.GetCurrentOSLanguage();
Settings.Language.Modified.Subscribe(() => TranslationManager.CurrentLanguage.Value = Settings.Language);

// event loop
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);

// exit
lockFile.Dispose();
}

Expand Down
12 changes: 5 additions & 7 deletions TuneLab/TuneLab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@
<ProjectReference Include="..\TuneLab.Extensions.Voices\TuneLab.Extensions.Voices.csproj" />
</ItemGroup>

<Target Name="CopyFiles" AfterTargets="Build">
<ItemGroup>
<Resources Include="Resources\**\*.*" />
</ItemGroup>

<Copy SourceFiles="@(Resources)" DestinationFolder="$(TargetDir)\Resources\%(RecursiveDir)" />
</Target>
<ItemGroup>
<None Update="Resources\**\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

0 comments on commit cdb8ab6

Please sign in to comment.