Change to CommonApplicationFolder as applicationPath

This commit is contained in:
glax 2023-05-22 01:49:53 +02:00
parent 8865bf284f
commit da1b0cb1cd
3 changed files with 6 additions and 18 deletions

View File

@ -1,8 +1,8 @@
using Logging; using Logging;
using Tranga; using Tranga;
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga-API"); string applicationFolderPath =
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga-API");
string logsFolderPath = Path.Join(applicationFolderPath, "logs"); string logsFolderPath = Path.Join(applicationFolderPath, "logs");
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt"); string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json"); string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");
@ -103,20 +103,8 @@ app.MapDelete("/Queue/Dequeue", (string taskType, string? connectorName, string?
taskManager.RemoveTaskFromQueue(task); taskManager.RemoveTaskFromQueue(task);
}); });
app.MapGet("/Settings/Get", () => new Settings(taskManager.settings)); app.MapGet("/Settings/Get", () => taskManager.settings);
app.MapPost("/Settings/Update", (string? downloadLocation, string? komgaUrl, string? komgaAuth) => taskManager.UpdateSettings(downloadLocation, komgaUrl, komgaAuth) ); app.MapPost("/Settings/Update", (string? downloadLocation, string? komgaUrl, string? komgaAuth) => taskManager.UpdateSettings(downloadLocation, komgaUrl, komgaAuth) );
app.Run(); app.Run();
class Settings
{
public string downloadLocation { get; }
public Komga? komga { get; }
public Settings(TrangaSettings settings)
{
this.downloadLocation = settings.downloadLocation;
this.komga = settings.komga;
}
}

View File

@ -14,7 +14,7 @@ public static class Tranga_Cli
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga"); string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga");
string logsFolderPath = Path.Join(applicationFolderPath, "logs"); string logsFolderPath = Path.Join(applicationFolderPath, "logs");
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt"); string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json"); string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");

View File

@ -14,7 +14,7 @@ public class TrangaSettings
public TrangaSettings(string downloadLocation, string? workingDirectory, Komga? komga) public TrangaSettings(string downloadLocation, string? workingDirectory, Komga? komga)
{ {
this.workingDirectory = workingDirectory ?? this.workingDirectory = workingDirectory ??
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga"); Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga");
this.downloadLocation = downloadLocation; this.downloadLocation = downloadLocation;
this.komga = komga; this.komga = komga;
} }