1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-23 01:24:07 +00:00

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.
This commit is contained in:
Andy McFadden
2021-10-08 11:01:03 -07:00
parent ed4cc84782
commit 1a00eb0cb7
2 changed files with 32 additions and 0 deletions

View File

@@ -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);