Bug 320602 (MONO77844) - monodocs2html cannot find some files
Summary: monodocs2html cannot find some files
Status: RESOLVED FIXED
Alias: MONO77844
Product: Mono: Doctools
Classification: Mono
Component: Console (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2006-03-19 02:34 UTC by Matthew Fulmer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch for monodocs2html (1.03 KB, patch)
2006-03-19 02:51 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:52:18 UTC


---- Reported by tapplek@gmail.com 2006-03-18 19:34:03 MST ----

When running monodocs2html against the sources in svn, there were some
entries in the index.xml file that were not actually documented. For
instance, in
svn://svn.myrealbox.com/source/trunk/monodoc/class/corlib/en/index.xml,
there exist entries for System.__ComObject and
System.Threading.CompressedStack, neither of which exist in the
svn://svn.myrealbox.com/source/trunk/monodoc/class/corlib/en/ directory. 

This mismatch confuses monodocs2html, and is exits with a
System.IO.FileNotFoundException about the missing files. There are at least
two solutions to this problem:

1. fix the index.xml files to exactly corespond with the directory structure.

2. fix monodocs2html to accept the existing index.xml, just like the
assembler does

I dislike solution 1, as it would cause any added files to also be added to
the index.xml file. I think solution 2 is better, because that is how the
assembler works. Thus I created a patch against
svn://svn.myrealbox.com/source/trunk/monodoc/ to fix monodocs2html. It just
wraps the html generator in an if(File.Exists()) block. Another solution
would be a try ... catch (FileNotFoundException) block. I don't know which
would be better, as I am new to C#. The patch is both inline and attached
(made with svn diff):

Index: tools/monodocs2html.cs
===================================================================
--- tools/monodocs2html.cs      (revision 58148)
+++ tools/monodocs2html.cs      (working copy)
@@ -116,12 +116,18 @@
                                if (opts.onlytype != null && !(nsname + "."
+ typename).StartsWith(opts.onlytype))
                                        continue;
 
-                               XmlDocument typexml = new XmlDocument();
-                               typexml.Load(opts.source + "/" + nsname +
"/" + typename + ".xml");
-                               
-                               Console.WriteLine(nsname + "." + typename);
-                               
-                               Generate(typexml, stylesheet, typeargs,
opts.dest + "/" + nsname + "/" + typename + "." + opts.ext, template);
+                               string sourcefile = opts.source + "/" +
nsname + "/" + typename + ".xml";
+
+                               if (System.IO.File.Exists(sourcefile)) {
+                                       string destfile = opts.dest + "/" +
nsname + "/" + typename + "." + opts.ext;
+                                       
+                                       XmlDocument typexml = new
XmlDocument();
+                                       typexml.Load(sourcefile);
+                                       
+                                       Console.WriteLine(nsname + "." +
typename);
+                                       
+                                       Generate(typexml, stylesheet,
typeargs, destfile, template);
+                               }
                        }
                }
        }



---- Additional Comments From tapplek@gmail.com 2006-03-18 19:51:27 MST ----

Created an attachment (id=169448)
patch for monodocs2html




---- Additional Comments From tapplek@gmail.com 2006-03-18 19:55:38 MST ----

The patch has a small problem: it generates some dead links in the
generated html: System, for example has a dead link to __ComObject.
Perhaps the first solution has merit. Or the patch is too simple. I am
not sure; I am rather new here.



---- Additional Comments From tauberer@for.net 2006-04-01 11:17:19 MST ----

I think the correct solution is to get the missing files in SVN,
although a check in monodocs2html would be good too (which I'll take
care of in a sec).  Thanks for pointing out the problem.

Imported an attachment (id=169448)

Unknown operating system unknown. Setting to default OS "Other".