Fixed README.md search function so that it works on IISNode and everything else, too.

This commit is contained in:
David Ball 2024-05-24 04:58:20 -04:00
parent 3470e1a809
commit e8d6c4b45e

View File

@ -50,7 +50,7 @@ const shouldOmitLinkOnLastBreadcrumb = ({paths, index}) => (index == paths.lengt
const resolveReadmeFile = ({directory}) => {
const resolveFile = (file) => {
const pathToFile = path.join(process.cwd(), "..", directory, file)
const pathToFile = path.join(__dirname, "..", "..", directory, file);
return fs.existsSync(pathToFile) ? pathToFile : "";
};
return (
@ -58,7 +58,7 @@ const resolveReadmeFile = ({directory}) => {
resolveFile("README.txt") ||
resolveFile("README") ||
resolveFile("README.html") ||
""
undefined
);
};
const directoryContainsReadme = ({directory}) => resolveReadmeFile({directory});