Skip to content

Commit

Permalink
Invert logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jul 8, 2023
1 parent 077d706 commit c7c73e3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,19 @@ function preprocessPlantUmlIncludes (diagramText, resource, includeOnce, include
*/
function resolveIncludeFile (includeFile, resource, includePaths, vfs) {
const exists = typeof vfs !== 'undefined' && typeof vfs.exists === 'function' ? vfs.exists : require('./node-fs.js').exists
if (resource.dir) {
let filePath = includeFile
console.log({ paths: [resource.dir, ...includePaths] })
for (const includePath of [resource.dir, ...includePaths]) {
const localFilePath = path.join(includePath, includeFile)
if (exists(localFilePath)) {
filePath = localFilePath
break
}
if (resource.module) {
// antora resource id
return includeFile
}
let filePath = includeFile
for (const includePath of [resource.dir, ...includePaths]) {
const localFilePath = path.join(includePath, includeFile)
if (exists(localFilePath)) {
filePath = localFilePath
break
}
return filePath
}
// antora resource id
return includeFile
return filePath
}

function parseTarget (value) {
Expand Down

0 comments on commit c7c73e3

Please sign in to comment.