Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 3120383

Browse files
author
Hermann Schinagl
committed
Allow already existing path with File.Goto and show already mapped UNC drive
1 parent 91dbf00 commit 3120383

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/wfgoto.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ SetCurrentPathOfWindow(LPWSTR szPath)
612612
switch (freeDriveFound)
613613
{
614614
case -1:
615-
// UNC Loop found. Throw your favourite messagebox here
615+
// UNC Loop found. e.g. \\foo\bar for existing drive \\foo\bar\share
616+
// Throw your favourite messagebox here
616617
break;
617618

618619
case 0:

src/wfutil.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,8 +1624,16 @@ BOOL TypeAheadString(WCHAR ch, LPWSTR szT)
16241624
BOOL FindUNCLoop(LPCTSTR path)
16251625
{
16261626
for (DWORD dwDriveIndex = OFFSET_UNC; dwDriveIndex < MAX_DRIVES; ++dwDriveIndex) {
1627-
if (aDriveInfo[dwDriveIndex].szRoot[0] && StrStrIW(aDriveInfo[dwDriveIndex].szRoot, path))
1628-
return TRUE;
1627+
if (aDriveInfo[dwDriveIndex].szRoot[0] && StrStrIW(aDriveInfo[dwDriveIndex].szRoot, path)) {
1628+
1629+
if (_wcsicmp(path, aDriveInfo[dwDriveIndex].szRoot))
1630+
// path a was a parent of an existing drive, e.g. \\foo\bar for \\foo\bar\share
1631+
// This is a loop, which can't be handled
1632+
return TRUE;
1633+
// else
1634+
// path is the same as an existing drive, e.g. \\foo\bar for \\foo\bar
1635+
// This is o ok
1636+
}
16291637
}
16301638
return FALSE;
16311639
}

0 commit comments

Comments
 (0)