From 447af3883cb497c9f46b61683305ffa05c35d408 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 15:48:12 +0000 Subject: [PATCH] fix: align GetHtmlDebugPath with AssetLoader two-hop path resolution Agent-Logs-Url: https://github.com/PepperDash/Essentials/sessions/9d7d71b4-b083-412b-b7b2-3167561eeed3 Co-authored-by: ndorin <18535240+ndorin@users.noreply.github.com> --- .../ServeDebugAppRequestHandler.cs | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ServeDebugAppRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ServeDebugAppRequestHandler.cs index 2092c735..d8a296e5 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/ServeDebugAppRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/ServeDebugAppRequestHandler.cs @@ -153,11 +153,11 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers /// Resolves the absolute path of the /HTML/debug folder on the processor. /// /// - /// On a 4-series appliance, Global.FilePathPrefix is - /// {root}/user/programX/, so walking up two parents gives the - /// processor root that contains the html folder. - /// On Virtual Control, Global.FilePathPrefix is {root}/User/, - /// so only one parent hop is needed. + /// Global.FilePathPrefix is always {root}/user/programX/ (or + /// equivalent), so walking up two parents gives the processor root that + /// contains the html folder. This mirrors the two-hop strategy used + /// by AssetLoader.ExtractDevToolsZip so that serving and extraction + /// always resolve to the same directory. /// private static string GetHtmlDebugPath() { @@ -166,17 +166,10 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers var separators = new[] { System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }; var programDir = new DirectoryInfo(Global.FilePathPrefix.TrimEnd(separators)); - DirectoryInfo rootDir; - if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) - { - // Virtual Control: {root}/User/ → one parent up = {root} - rootDir = programDir.Parent; - } - else - { - // 4-series appliance: {root}/user/programX/ → two parents up = {root} - rootDir = programDir.Parent?.Parent; - } + // Walk up two levels: {root}/user/programX/ → {root}/user/ → {root} + // This matches the path calculation used in AssetLoader.ExtractDevToolsZip. + var userOrNvramDir = programDir.Parent; + var rootDir = userOrNvramDir?.Parent; if (rootDir == null) {