Skip to content

Commit

Permalink
fix: fail path resolve for windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
ytetsuro committed May 25, 2023
1 parent 36eddc6 commit 45b1b95
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Sabik/FileFinder/FileFinder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import { inject, injectable } from 'inversify';
import { resolve, sep } from 'path';
import { resolve, sep, isAbsolute } from 'path';
import { Types } from '../../types/Types';
import { File } from './File';

Expand Down Expand Up @@ -45,9 +45,8 @@ export class FileFinder {

private getFullPath(path: string) {
const formattedPath = path.endsWith(sep) ? path.substr(0, path.length - 1) : path;
const isAbstractPath = resolve(formattedPath) === formattedPath;

return resolve(isAbstractPath ? formattedPath : `${this.currentPath}${sep}${formattedPath}`);
return resolve(isAbsolute(path) ? formattedPath : `${this.currentPath}${sep}${formattedPath}`);
}

private isTarget(path: string) {
Expand Down

0 comments on commit 45b1b95

Please sign in to comment.