mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-04 02:31:36 +00:00
refactor: skip redundant sibling path computation when targetRaw has no backslashes
Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/5236f2b8-72a0-476d-bf39-cca041781014 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
parent
79bbd7872e
commit
23d577144c
1 changed files with 7 additions and 4 deletions
|
|
@ -29,10 +29,13 @@ export function resolveCImportTarget(
|
|||
const siblingRaw = join(dirname(fromFile), targetRaw);
|
||||
const sibling = siblingRaw.replace(/\\/g, '/');
|
||||
if (allFilePaths.has(sibling)) return sibling;
|
||||
// Also try normalized target in case targetRaw has slashes
|
||||
const siblingAlt = join(dirname(fromFile), normalizedTarget);
|
||||
const siblingAltNorm = siblingAlt.replace(/\\/g, '/');
|
||||
if (siblingAltNorm !== sibling && allFilePaths.has(siblingAltNorm)) return siblingAltNorm;
|
||||
// When targetRaw contains backslashes, the normalized form may
|
||||
// resolve to a different sibling path — try it as well.
|
||||
if (targetRaw !== normalizedTarget) {
|
||||
const siblingAlt = join(dirname(fromFile), normalizedTarget);
|
||||
const siblingAltNorm = siblingAlt.replace(/\\/g, '/');
|
||||
if (allFilePaths.has(siblingAltNorm)) return siblingAltNorm;
|
||||
}
|
||||
}
|
||||
|
||||
// Exact match (path as-is in the workspace)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue