Skip to content

Commit

Permalink
fix(plugin): attempt to fix broken windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 27, 2023
1 parent e39a720 commit 0e44bbf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/plugin/utils/plugin-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function replaceImportPath(
};
} catch (_error) {
const from = options?.readonly
? options.pathToSource
? convertPath(options.pathToSource)
: posix.dirname(convertPath(fileName));

let relativePath = posix.relative(from, importPath);
Expand Down
5 changes: 4 additions & 1 deletion lib/plugin/visitors/controller-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ export class ControllerClassVisitor extends AbstractFileVisitor {
}

private normalizeImportPath(pathToSource: string, path: string) {
let relativePath = posix.relative(pathToSource, convertPath(path));
let relativePath = posix.relative(
convertPath(pathToSource),
convertPath(path)
);
relativePath = relativePath[0] !== '.' ? './' + relativePath : relativePath;
return relativePath;
}
Expand Down
5 changes: 4 additions & 1 deletion lib/plugin/visitors/model-class.visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,10 @@ export class ModelClassVisitor extends AbstractFileVisitor {
}

private normalizeImportPath(pathToSource: string, path: string) {
let relativePath = posix.relative(pathToSource, convertPath(path));
let relativePath = posix.relative(
convertPath(pathToSource),
convertPath(path)
);
relativePath = relativePath[0] !== '.' ? './' + relativePath : relativePath;
return relativePath;
}
Expand Down

0 comments on commit 0e44bbf

Please sign in to comment.