From 95cef0dc16c13e43a85574594571d2f387383a8a Mon Sep 17 00:00:00 2001 From: EX3 Date: Fri, 4 Oct 2024 11:38:06 +0900 Subject: [PATCH] Added path logs --- Mirivoice/App.axaml.cs | 1 - Mirivoice/Mirivoice.Core/Managers/MainManager.cs | 11 ++++++++--- Mirivoice/Mirivoice.Core/Managers/PathManager.cs | 12 +++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Mirivoice/App.axaml.cs b/Mirivoice/App.axaml.cs index 353496d..e2b20c9 100644 --- a/Mirivoice/App.axaml.cs +++ b/Mirivoice/App.axaml.cs @@ -34,7 +34,6 @@ public override void OnFrameworkInitializationCompleted() { - //Lang.Resources.Culture = new CultureInfo("ko-KR"); if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { var args = Environment.GetCommandLineArgs(); diff --git a/Mirivoice/Mirivoice.Core/Managers/MainManager.cs b/Mirivoice/Mirivoice.Core/Managers/MainManager.cs index f998f4f..54a3d35 100644 --- a/Mirivoice/Mirivoice.Core/Managers/MainManager.cs +++ b/Mirivoice/Mirivoice.Core/Managers/MainManager.cs @@ -35,6 +35,7 @@ public class MainManager : SingletonBase public void Initialize() { + Log.Information($"RootPath: {MainManager.Instance.PathM.RootPath}"); CheckDirs(); UpdateDefaultVoicers(); LoadVoicerManager(); @@ -176,11 +177,15 @@ public static void ExtractSplitZip(string zipFilePath, string extractPath) } } - if (!OS.IsMacOS()) + try { - DeleteExtractedZip(zipFilePath); // cannot delete asset on MacOS because it is in app bundle + DeleteExtractedZip(zipFilePath); } - + catch (Exception ex) + { + Log.Error($"Error deleting extracted zip: {ex.Message}"); + } + } } diff --git a/Mirivoice/Mirivoice.Core/Managers/PathManager.cs b/Mirivoice/Mirivoice.Core/Managers/PathManager.cs index 589bdca..c9d0070 100644 --- a/Mirivoice/Mirivoice.Core/Managers/PathManager.cs +++ b/Mirivoice/Mirivoice.Core/Managers/PathManager.cs @@ -4,6 +4,8 @@ using System.Globalization; using System.IO; using System.Reflection; +using System.Runtime.InteropServices; +using Serilog; namespace Mirivoice.Mirivoice.Core.Managers { @@ -20,11 +22,12 @@ public class PathManager public string LogFilePath => Path.Combine(DataPath, "Logs", "log.txt"); public string VoicerPath => Path.Combine(DataPath, "Voicers"); - public string AssetsPath => Path.Combine(RootPath, "Assets"); + public string AssetsPath; public PathManager() { RootPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + if (!Directory.Exists(RootPath)) { Directory.CreateDirectory(RootPath); @@ -34,6 +37,7 @@ public PathManager() if (OS.IsMacOS()) { + AssetsPath = Path.Combine(RootPath, "Assets"); string userHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); DataPath = Path.Combine(userHome, "MiriVoice", "Datas"); CachePath = Path.Combine(userHome, "MiriVoice", "Caches"); @@ -44,7 +48,8 @@ public PathManager() } else if (OS.IsLinux()) { - string userHome = Environment.GetFolderPath(Environment.SpecialFolder.Personal); + AssetsPath = Path.Combine(RootPath, "Assets"); + string userHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string dataHome = Environment.GetEnvironmentVariable("XDG_DATA_HOME"); if (string.IsNullOrEmpty(dataHome)) { @@ -63,6 +68,7 @@ public PathManager() } else { + AssetsPath = Path.Combine(RootPath, "Assets"); string exePath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); IsInstalled = File.Exists(Path.Combine(exePath, "installed.txt")); if (!IsInstalled) @@ -71,7 +77,7 @@ public PathManager() } else { - string dataHome = Environment.GetFolderPath(Environment.SpecialFolder.Personal); + string dataHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); DataPath = Path.Combine(dataHome, "MiriVoice"); } CachePath = Path.Combine(DataPath, "Cache");