From 69e86bfa26dab755fbb7034d21fa6a298674aaf7 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Mon, 24 Apr 2023 11:11:43 +0200 Subject: [PATCH] Add try and update path + version in publish profile --- .../Controllers/ConfigurationController.cs | 21 +++++++++++++------ .../PublishProfiles/registry.unov.be.pubxml | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ManagerService/Controllers/ConfigurationController.cs b/ManagerService/Controllers/ConfigurationController.cs index 29a2d4a..3e9b4d9 100644 --- a/ManagerService/Controllers/ConfigurationController.cs +++ b/ManagerService/Controllers/ConfigurationController.cs @@ -303,7 +303,7 @@ namespace ManagerService.Controllers #if RELEASE Console.WriteLine($"currentDirectory: {Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}"); //currentDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "service-data"); - currentDirectory = Path.Combine("home", "debian", "service-data"); + currentDirectory = Path.Combine("/home", "debian", "service-data"); System.IO.Directory.CreateDirectory(currentDirectory.ToString()); #endif @@ -540,14 +540,23 @@ namespace ManagerService.Controllers private void createFile(String fileName, byte[] fileBytes) { - using (FileStream fs = System.IO.File.Create(fileName)) + try { - Console.WriteLine($"Try to create file at : {fileName}"); + using (FileStream fs = System.IO.File.Create(fileName)) + { + + Console.WriteLine($"Try to create file at : {fileName}"); - // Add some information to the file. - fs.Write(fileBytes, 0, fileBytes.Length); + // Add some information to the file. + fs.Write(fileBytes, 0, fileBytes.Length); - Console.WriteLine($"Created file: {fileName}"); + Console.WriteLine($"Created file: {fileName}"); + + } + } + catch (Exception ex) + { + Console.WriteLine($"An error occured during file creation: {fileName} - {ex.Message}"); } } diff --git a/ManagerService/Properties/PublishProfiles/registry.unov.be.pubxml b/ManagerService/Properties/PublishProfiles/registry.unov.be.pubxml index a0dae9e..5cce5e0 100644 --- a/ManagerService/Properties/PublishProfiles/registry.unov.be.pubxml +++ b/ManagerService/Properties/PublishProfiles/registry.unov.be.pubxml @@ -9,7 +9,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt true https://registry.unov.be admin - latest + version_1_0 ContainerRegistry Release Any CPU