diff options
author | Joel Martinez <joelmartinez@gmail.com> | 2017-09-01 18:56:01 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2017-09-02 00:13:07 +0300 |
commit | f74333c3d3ce98198093a98e1b2112bbfbbab715 (patch) | |
tree | 0e881cbf4a35cbdc3c28e2b21ac6d431a52d8c5f /mdoc | |
parent | 884c5bd783c042562eeec0798384ff7fabb73852 (diff) |
mdoc: now tolerant of import paths that use the opposite directory separator char for the OS
Diffstat (limited to 'mdoc')
-rw-r--r-- | mdoc/Mono.Documentation/monodocer.cs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/mdoc/Mono.Documentation/monodocer.cs b/mdoc/Mono.Documentation/monodocer.cs index 81fc53a0..a7842815 100644 --- a/mdoc/Mono.Documentation/monodocer.cs +++ b/mdoc/Mono.Documentation/monodocer.cs @@ -4014,13 +4014,25 @@ class MsxdocDocumentationImporter : DocumentationImporter { public MsxdocDocumentationImporter (string file) { - var xml = File.ReadAllText (file); + try + { + char oppositeSlash = Path.DirectorySeparatorChar == '/' ? '\\' : '/'; + if (file.Contains (oppositeSlash)) + file = file.Replace (oppositeSlash, Path.DirectorySeparatorChar); + + var xml = File.ReadAllText (file); - // Ensure Unix line endings - xml = xml.Replace ("\r", ""); + // Ensure Unix line endings + xml = xml.Replace ("\r", ""); - slashdocs = new XmlDocument(); - slashdocs.LoadXml (xml); + slashdocs = new XmlDocument (); + + slashdocs.LoadXml (xml); + } + catch (IOException ex) + { + Console.WriteLine ($"Importer Error: {ex.Message}"); + } } public override void ImportDocumentation (DocsNodeInfo info) @@ -4105,7 +4117,7 @@ class MsxdocDocumentationImporter : DocumentationImporter { private XmlNode GetDocs (MemberReference member) { string slashdocsig = MDocUpdater.slashdocFormatter.GetDeclaration (member); - if (slashdocsig != null) + if (slashdocsig != null && slashdocs != null) return slashdocs.SelectSingleNode ("doc/members/member[@name='" + slashdocsig + "']"); return null; } |