diff --git a/CredentialManager/design_time_temp.db b/CredentialManager/design_time_temp.db deleted file mode 100644 index 02bade7..0000000 Binary files a/CredentialManager/design_time_temp.db and /dev/null differ diff --git a/Data_Coupler/Program.cs b/Data_Coupler/Program.cs index efb4e83..fba3fcc 100644 --- a/Data_Coupler/Program.cs +++ b/Data_Coupler/Program.cs @@ -23,11 +23,39 @@ builder.Services.AddServerSideBlazor(); builder.Services.AddWindowsService(); builder.Services.AddHostedService(); -// Add CredentialManager services -var contentRoot = builder.Environment.ContentRootPath; -var dataPath = Path.Combine(contentRoot, "wwwroot", "data"); -Directory.CreateDirectory(dataPath); // Assicurati che la directory esista -var dbPath = Path.Combine(dataPath, "credentials.db"); +#region Database Directory Path management + +string dbPath = string.Empty; + +if (OperatingSystem.IsWindows()) +{ + dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Data_Coupler", "credentials.db"); +} +else if (OperatingSystem.IsLinux()) +{ + dbPath = "/var/lib/Data_Coupler/credentials.db"; +} +else if (OperatingSystem.IsMacOS()) +{ + dbPath = "/Library/Application Support/Data_Coupler/credentials.db"; +} + +var dbDirectory = Path.GetDirectoryName(dbPath); +if (!Directory.Exists(dbDirectory)) +{ + Directory.CreateDirectory(dbDirectory!); +} + +#endregion + +#region OLD DB PATH +// // Add CredentialManager services +// var contentRoot = builder.Environment.ContentRootPath; +// var dataPath = Path.Combine(contentRoot, "wwwroot", "data"); +// Directory.CreateDirectory(dataPath); // Assicurati che la directory esista +// var dbPath = Path.Combine(dataPath, "credentials.db"); +#endregion + builder.Services.AddDataConnectionCredentialManagement($"Data Source={dbPath}"); // Register IHttpClientFactory diff --git a/CredentialManager/Test/Program.cs b/TestCredentialDatabaseName/Program.cs similarity index 100% rename from CredentialManager/Test/Program.cs rename to TestCredentialDatabaseName/Program.cs diff --git a/CredentialManager/CLI/CredentialManagerCLI.cs b/TestCredentialDatabaseName/TestCredentialDatabaseName.csproj similarity index 100% rename from CredentialManager/CLI/CredentialManagerCLI.cs rename to TestCredentialDatabaseName/TestCredentialDatabaseName.csproj diff --git a/CredentialManager/CLI/README.md b/TestSourceDatabaseName/Program.cs similarity index 100% rename from CredentialManager/CLI/README.md rename to TestSourceDatabaseName/Program.cs diff --git a/TestSourceDatabaseName/TestSourceDatabaseName.csproj b/TestSourceDatabaseName/TestSourceDatabaseName.csproj new file mode 100644 index 0000000..e69de29