check if README.md exists before attempting to read it #490
Conversation
Hi @h13i32maru, thoughts on this? |
Unfortunately it's been very hard getting word back from the author, he's not very responsive anymore, some of the dependencies are over a year old now, and he wont let anyone join his organization. I've since moved on with esdoc2, would recommend you check it out and send the PR there if you would be so kind to do so |
@MattMcFarland Thanks for the info, Matt! Nice work on #480! I'll get set up with esdoc2 and see if I can replicate the issue, if so I'll submit a PR there. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Problem
This PR addresses #432, a bug where esdoc fails to run if a
README.md
file is not present at the root of a given project. The bug occurs because the default behaviour of esdoc is to attempt to read that file regardless of whether or not it exists.Solution
The simple solution here is to check if the file exists before attempting to read from it, and fall back to empty string as the index content if the file does not exist.
Further thoughts
On the issue there are reports of esdoc also crashing if a readme is present at the top level of the project but its not named exactly
README.md
, which may frequently be the case on case sensitive file systems. This PR does not remedy that scenario by reading the correct file but it will at least allow esdoc to run without crashing. It is up to the user then to find the correct configuration option from theESDoc Config
table here: https://github.com/esdoc/esdoc-site/blob/master/src/manual/config.mdOutcome
Resolves #432 and duplicate #484.