Skip to content
Browse files

[windoc] Redirect HTML content to a temp file to get correct asset pa…

…th handling
  • Loading branch information...
1 parent 88993c6 commit 830df8d190faa749dd5ededc6bbe087d6a457c69 @garuma garuma committed May 2, 2012
Showing with 14 additions and 5 deletions.
  1. +4 −1 windoc/WinDoc/MainWindow.cs
  2. +10 −4 windoc/WinDoc/Program.cs
View
5 windoc/WinDoc/MainWindow.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -233,7 +234,9 @@ void LoadUrl (string url, bool syncTreeView = false, HelpSource source = null, b
void LoadHtml (string html)
{
loadedFromString = true;
- docBrowser.DocumentText = html;
+ var documentUri = Path.Combine (Program.MonoDocDir, "doc.html");
+ File.WriteAllText (documentUri, html);
+ docBrowser.Navigate ("file://" + Path.GetFullPath (documentUri));
}
bool ShowNodeInTree (Node node)
View
14 windoc/WinDoc/Program.cs
@@ -11,7 +11,7 @@ namespace WinDoc
{
static class Program
{
- static string MonodocDir;
+ static string monodocDir;
[STAThread]
static void Main(string[] args)
@@ -55,8 +55,8 @@ static void Main(string[] args)
static void PrepareCache ()
{
- MonodocDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc", "Caches");
- var mdocimages = Path.Combine (MonodocDir, "mdocimages");
+ monodocDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "WinDoc", "Caches");
+ var mdocimages = Path.Combine (monodocDir, "mdocimages");
if (!Directory.Exists (mdocimages)){
try {
Directory.CreateDirectory (mdocimages);
@@ -72,7 +72,7 @@ static void ExtractImages ()
if (!res.EndsWith (".png") || res.EndsWith (".jpg"))
continue;
- var image = Path.Combine (MonodocDir, "mdocimages", res);
+ var image = Path.Combine (monodocDir, "mdocimages", res);
if (File.Exists (image))
continue;
@@ -103,5 +103,11 @@ static void SetupLogging ()
get;
private set;
}
+
+ public static string MonoDocDir {
+ get {
+ return monodocDir;
+ }
+ }
}
}

0 comments on commit 830df8d

Please sign in to comment.
Something went wrong with that request. Please try again.