Skip to content

Commit 4967774

Browse files
Copiloticlanton
andcommitted
Fix Windows path separator issue by normalizing to forward slashes for LookupByPath
Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
1 parent 395cc75 commit 4967774

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

libraries/rush-lib/src/logic/selectors/PathProjectSelectorParser.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,24 @@ export class PathProjectSelectorParser implements ISelectorParser<RushConfigurat
3131
// Relativize it to the rushJsonFolder
3232
const relativePath: string = nodePath.relative(this._rushConfiguration.rushJsonFolder, absolutePath);
3333

34+
// Normalize path separators to forward slashes for LookupByPath
35+
const normalizedPath: string = relativePath.split(nodePath.sep).join('/');
36+
3437
// Get the LookupByPath instance for the Rush root
3538
const lookupByPath: LookupByPath<RushConfigurationProject> =
3639
this._rushConfiguration.getProjectLookupForRoot(this._rushConfiguration.rushJsonFolder);
3740

3841
// Check if this path is within a project or matches a project exactly
39-
const containingProject: RushConfigurationProject | undefined = lookupByPath.findChildPath(relativePath);
42+
const containingProject: RushConfigurationProject | undefined =
43+
lookupByPath.findChildPath(normalizedPath);
4044

4145
if (containingProject) {
4246
return [containingProject];
4347
}
4448

4549
// Check if there are any projects under this path (i.e., it's a directory containing projects)
4650
const projectsUnderPath: Set<RushConfigurationProject> = new Set();
47-
for (const [, project] of lookupByPath.entries(relativePath)) {
51+
for (const [, project] of lookupByPath.entries(normalizedPath)) {
4852
projectsUnderPath.add(project);
4953
}
5054

0 commit comments

Comments
 (0)