Skip to content

Commit

Permalink
Added path logs
Browse files Browse the repository at this point in the history
  • Loading branch information
EX3exp committed Oct 4, 2024
1 parent bc35d95 commit 95cef0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 0 additions & 1 deletion Mirivoice/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public override void OnFrameworkInitializationCompleted()
{


//Lang.Resources.Culture = new CultureInfo("ko-KR");
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var args = Environment.GetCommandLineArgs();
Expand Down
11 changes: 8 additions & 3 deletions Mirivoice/Mirivoice.Core/Managers/MainManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MainManager : SingletonBase<MainManager>

public void Initialize()
{
Log.Information($"RootPath: {MainManager.Instance.PathM.RootPath}");
CheckDirs();
UpdateDefaultVoicers();
LoadVoicerManager();
Expand Down Expand Up @@ -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}");
}

}

}
Expand Down
12 changes: 9 additions & 3 deletions Mirivoice/Mirivoice.Core/Managers/PathManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Serilog;

namespace Mirivoice.Mirivoice.Core.Managers
{
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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))
{
Expand All @@ -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)
Expand All @@ -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");
Expand Down

0 comments on commit 95cef0d

Please sign in to comment.