From 04257f75e74f48620ec1edc3fa82e81bb308ddb6 Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Tue, 4 Aug 2020 13:06:54 -0400 Subject: [PATCH] modifications for System Update feature --- Oqtane.Server/Infrastructure/InstallationManager.cs | 2 +- Oqtane.Upgrade/Program.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs index c39978b7..cbe3685f 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -98,7 +98,7 @@ namespace Oqtane.Infrastructure ExtractFile(entry, filename); break; case "wwwroot": - filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace($"wwwroot/", "").Split('/'))); + filename = Path.Combine(webRootPath.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), Utilities.PathCombine(entry.FullName.Split('/'))); ExtractFile(entry, filename); break; case "runtimes": diff --git a/Oqtane.Upgrade/Program.cs b/Oqtane.Upgrade/Program.cs index 10a55ad4..af2665e0 100644 --- a/Oqtane.Upgrade/Program.cs +++ b/Oqtane.Upgrade/Program.cs @@ -58,7 +58,7 @@ namespace Oqtane.Upgrade files.Add(Path.Combine(binfolder, filename)); break; case "wwwroot": - files.Add(Path.Combine(webrootfolder, entry.FullName.Replace("wwwroot/", "").Replace("/", Path.DirectorySeparatorChar.ToString()))); + files.Add(Path.Combine(webrootfolder.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), entry.FullName.Replace('/', Path.DirectorySeparatorChar))); break; } } @@ -102,21 +102,26 @@ namespace Oqtane.Upgrade filename = Path.Combine(binfolder, filename); break; case "wwwroot": - filename = Path.Combine(webrootfolder, entry.FullName.Replace("wwwroot/", "").Replace("/", Path.DirectorySeparatorChar.ToString())); + filename = Path.Combine(webrootfolder.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), entry.FullName.Replace('/', Path.DirectorySeparatorChar)); break; } if (files.Contains(filename)) { + if (!Directory.Exists(Path.GetDirectoryName(filename))) + { + Directory.CreateDirectory(Path.GetDirectoryName(filename)); + } entry.ExtractToFile(filename, true); } } } } } - catch + catch (Exception ex) { // an error occurred extracting a file success = false; + Console.WriteLine("Update Not Successful: Error Extracting Files From Package - " + ex.Message); } if (success) @@ -135,8 +140,6 @@ namespace Oqtane.Upgrade } else { - Console.WriteLine("Update Not Successful: Error Extracting Files From Package"); - // restore on failure foreach (string file in files) {