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>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-04 15:48:12 +00:00 committed by GitHub
parent 3b57860123
commit 447af3883c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -153,11 +153,11 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
/// Resolves the absolute path of the /HTML/debug folder on the processor. /// Resolves the absolute path of the /HTML/debug folder on the processor.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// On a 4-series appliance, <c>Global.FilePathPrefix</c> is /// <c>Global.FilePathPrefix</c> is always <c>{root}/user/programX/</c> (or
/// <c>{root}/user/programX/</c>, so walking up two parents gives the /// equivalent), so walking up two parents gives the processor root that
/// processor root that contains the <c>html</c> folder. /// contains the <c>html</c> folder. This mirrors the two-hop strategy used
/// On Virtual Control, <c>Global.FilePathPrefix</c> is <c>{root}/User/</c>, /// by <c>AssetLoader.ExtractDevToolsZip</c> so that serving and extraction
/// so only one parent hop is needed. /// always resolve to the same directory.
/// </remarks> /// </remarks>
private static string GetHtmlDebugPath() 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 separators = new[] { System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar };
var programDir = new DirectoryInfo(Global.FilePathPrefix.TrimEnd(separators)); var programDir = new DirectoryInfo(Global.FilePathPrefix.TrimEnd(separators));
DirectoryInfo rootDir; // Walk up two levels: {root}/user/programX/ → {root}/user/ → {root}
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) // This matches the path calculation used in AssetLoader.ExtractDevToolsZip.
{ var userOrNvramDir = programDir.Parent;
// Virtual Control: {root}/User/ → one parent up = {root} var rootDir = userOrNvramDir?.Parent;
rootDir = programDir.Parent;
}
else
{
// 4-series appliance: {root}/user/programX/ → two parents up = {root}
rootDir = programDir.Parent?.Parent;
}
if (rootDir == null) if (rootDir == null)
{ {