Skip to content

Commit

Permalink
attempt different fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Apr 29, 2024
1 parent 742dfc4 commit f892d8e
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/docgen/view/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,10 @@ export class Documentation {
});

const ts = new reflect.TypeSystem();
const searchPattern = normalizePathForGlob(this.assembliesDir) + `/**/${SPEC_FILE_NAME}`;
for (let dotJsii of await glob.promise(searchPattern)) {

// assembliesDir might include backslashes on Windows.
// The glob pattern must only used forward slashes, so we pass the assembliesDir as CWD which does not have this restriction
for (let dotJsii of await glob.promise(`**/${SPEC_FILE_NAME}`, { cwd: path.normalize(this.assembliesDir) })) {
// we only transliterate the top level assembly and not the entire type-system.
// note that the only reason to translate dependant assemblies is to show code examples
// for expanded python arguments - which we don't to right now anyway.
Expand Down Expand Up @@ -557,11 +559,3 @@ function maybeCorruptedAssemblyError(error: Error): CorruptedAssemblyError | und
}
return;
}

/**
* glob needs the pattern to only use forward slashes.
* So we split the path based on the current platforms separator and re-join using /.
*/
function normalizePathForGlob(pattern: string): string {
return path.normalize(pattern).split(path.sep).join(path.posix.sep);
}

0 comments on commit f892d8e

Please sign in to comment.