2024-04-19 19:25:44 +00:00
|
|
|
using AIStudio.Settings;
|
2024-04-05 20:23:36 +00:00
|
|
|
using Microsoft.AspNetCore.Components;
|
2024-04-05 14:16:33 +00:00
|
|
|
|
2024-04-05 20:23:36 +00:00
|
|
|
namespace AIStudio.Components.Layout;
|
|
|
|
|
|
|
|
public partial class MainLayout : LayoutComponentBase
|
2024-04-05 14:16:33 +00:00
|
|
|
{
|
2024-04-05 20:23:36 +00:00
|
|
|
[Inject]
|
|
|
|
private IJSRuntime JsRuntime { get; set; } = null!;
|
|
|
|
|
2024-04-05 14:16:33 +00:00
|
|
|
#region Overrides of ComponentBase
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
2024-05-04 08:55:00 +00:00
|
|
|
//
|
|
|
|
// We use the Tauri API (Rust) to get the data and config directories
|
|
|
|
// for this app.
|
|
|
|
//
|
2024-04-05 20:23:36 +00:00
|
|
|
var dataDir = await this.JsRuntime.InvokeAsync<string>("window.__TAURI__.path.appLocalDataDir");
|
|
|
|
var configDir = await this.JsRuntime.InvokeAsync<string>("window.__TAURI__.path.appConfigDir");
|
2024-05-04 08:55:00 +00:00
|
|
|
|
|
|
|
// Store the directories in the settings manager:
|
2024-04-05 20:23:36 +00:00
|
|
|
SettingsManager.ConfigDirectory = configDir;
|
|
|
|
SettingsManager.DataDirectory = dataDir;
|
|
|
|
|
2024-04-05 14:16:33 +00:00
|
|
|
await base.OnInitializedAsync();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|