From 1a00eb0cb7e7c7c012a85ce52549712d1b0b32b3 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 8 Oct 2021 11:01:03 -0700 Subject: [PATCH] Add warning to manual when viewed from web Added a warning to the index page that only appears when viewing it over http/https. The issue is that the manual on the web reflects the tip-of-tree sources, which may be inaccurate for whatever version the user has. Also, provide an alternate path to opening the manual in-app when under development. --- SourceGen/HelpAccess.cs | 11 +++++++++++ docs/sgmanual/index.html | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/SourceGen/HelpAccess.cs b/SourceGen/HelpAccess.cs index 3c5ad48..2e7c192 100644 --- a/SourceGen/HelpAccess.cs +++ b/SourceGen/HelpAccess.cs @@ -84,6 +84,17 @@ namespace SourceGen { string helpFilePath = Path.Combine(RuntimeDataAccess.GetDirectory(), HELP_DIR, fileName); + if (!File.Exists(helpFilePath)) { + // Alternate path, used during development. If it also doesn't exist, leave + // the original path intact so the error message is useful. + string altPath = Path.Combine(RuntimeDataAccess.GetDirectory() + + "\\..\\..\\docs\\sgmanual", + fileName); + altPath = Path.GetFullPath(altPath); // normalize + if (File.Exists(altPath)) { + helpFilePath = altPath; + } + } string url = "file://" + helpFilePath; //url = url.Replace("#", "%23"); Debug.WriteLine("Requesting help URL: " + url); diff --git a/docs/sgmanual/index.html b/docs/sgmanual/index.html index 5c1d9c3..139c156 100644 --- a/docs/sgmanual/index.html +++ b/docs/sgmanual/index.html @@ -18,6 +18,16 @@ and 65816 code. The official web site is

If you want to get up to speed quickly, start with the tutorials.

+ +

Contents