Migrated the data & config directory retrieval from Tauri JS to the runtime API

This commit is contained in:
tsommer committed 2024-08-29 13:07:42 +02:00
1 parent 88ea640a68
commit 9f41062cb4
3 files changed
+59 -9

No files matched your search

@@ -87,6 +87,30 @@ public sealed class RustService(string apiPort) : IDisposable
}
}
public async Task<string> GetConfigDirectory()
{
var response = await this.http.GetAsync("/system/directories/config");
if (!response.IsSuccessStatusCode)
{
this.logger!.LogError($"Failed to get the config directory from Rust: '{response.StatusCode}'");
return string.Empty;
}
return await response.Content.ReadAsStringAsync();
}
public async Task<string> GetDataDirectory()
{
var response = await this.http.GetAsync("/system/directories/data");
if (!response.IsSuccessStatusCode)
{
this.logger!.LogError($"Failed to get the data directory from Rust: '{response.StatusCode}'");
return string.Empty;
}
return await response.Content.ReadAsStringAsync();
}
/// <summary>
/// Tries to copy the given text to the clipboard.
/// </summary>