Project

General

Profile

Design #1504

OnlineHelp: XMLFileName

Added by John Abbott over 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Manual/documentation
Target version:
Start date:
08 Oct 2020
Due date:
% Done:

100%

Estimated time:
2.01 h
Spent time:

Description

In OnlineHelp.C there is a fn XMLFileName which should give the full path of the XML file.

Current this fn returns a const char*. Why is it not a const std::string&?

Also, the error mesg if CoCoAHelp.xml is not found where expected should probably also give the full path (to help debugging).


Related issues

Related to CoCoA-5 - Slug #1506: Remove XMLFileName from Main.CClosed2020-10-09

Related to CoCoA-5 - Bug #1397: Crashes if CoCoAHelp.xml is missingClosed2020-01-21

History

#1 Updated by John Abbott over 3 years ago

I think changing the return type of XMLFileName should be trivial (and not cause problems).

Changing the error mesg should also be fairly easy...

Any objections?

#2 Updated by John Abbott over 3 years ago

  • Status changed from New to In Progress
  • Assignee set to John Abbott
  • % Done changed from 0 to 20

I have changed XMLFileName to return a std::string. Everything compiles and runs OK.

The next stage is to make a single function for opening an istream to this file (with helpful error mesg if the file cannot be opened).

#3 Updated by John Abbott over 3 years ago

  • Related to Slug #1506: Remove XMLFileName from Main.C added

#4 Updated by John Abbott over 3 years ago

  • % Done changed from 20 to 50

I have now added a fn OpenXMLManual which tries to open the file, and throws a helpful exception if there is trouble.

Note: there is a hack in PrintManExamples.C: the exception is caught via catch (...) to avoid having to include too much CoCoALib.
First verification trial have gone well.

Maybe XMLFileName can even be fully replaced by OpenXMLManual (but see issue #1506)....
BUT to do this we must rewrite myLoadExtraXML so that it accepts istream instead of the filename as a string... :-/
OUCH! it seems that myLoadExtraXML also uses the filename internally :-(

Qn: why in OnlineHelp.C do the calls to myAddEntry (around lines 198 and 201) need to know the name of the file being read?
This prevents me from changing myLoadExtraXML so that it accepts an already open istream -- not entirely sure whether this change is actually a good idea. :-/

#5 Updated by John Abbott over 3 years ago

After discussing with Anna: the filenames are essential for the manual mechanism to work. So my idea to pass istream instead of a filename cannot work.
Anna will check the design.

#6 Updated by John Abbott over 2 years ago

  • % Done changed from 50 to 70

I suppose the current status must be acceptable. No problems have been reported for a year.
Close?

#7 Updated by John Abbott over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 70 to 80

Can we close this issue?

#8 Updated by Anna Maria Bigatti over 2 years ago

  • Related to Bug #1397: Crashes if CoCoAHelp.xml is missing added

#9 Updated by Anna Maria Bigatti over 2 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 80 to 100
  • Estimated time set to 2.01 h

Tested on linux and Mac. OK.

Also available in: Atom PDF