Skip to content

Commit

Permalink
Windows support
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Fournet <[email protected]>
  • Loading branch information
xfournet committed Jan 9, 2025
1 parent f4c5f26 commit 075e3c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
6 changes: 3 additions & 3 deletions api_generator/src/renderers/render_types/TypesContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class TypesContainer {
}

static import_path (from: { file_path: string }, to: { file_path: string }): string {
const relative = path.relative(path.dirname(to.file_path), from.file_path).replace('.d.ts', '')
const relative = path.relative(path.dirname(to.file_path), from.file_path).replace('.d.ts', '').replaceAll('\\', '/')
return relative.startsWith('.') ? relative : `./${relative}`
}

Expand All @@ -58,10 +58,10 @@ export default class TypesContainer {
let file_path: string = 'UNSET'
if (ref.startsWith('#/components')) {
const file_name = ref.split(SEPARATOR)[0].split('/').reverse()[0]
file_path = `${TYPE_COMPONENTS_FOLDER}/${file_name}.d.ts`
file_path = path.join(TYPE_COMPONENTS_FOLDER, `${file_name}.d.ts`)
} else {
const [folder_name, file_name] = ref.split(SEPARATOR)[0].split('/')
file_path = `${folder_name}/${file_name}.d.ts`
file_path = path.join(folder_name, `${file_name}.d.ts`)
}
const container = TypesContainer.REPO.get(file_path)
if (!container) throw new Error(`Container not found for: ${ref} -> ${file_path}`)
Expand Down

0 comments on commit 075e3c7

Please sign in to comment.