Bug #389

RealizeDirectory() fails in some UNC paths

Added by Iñaki Zabala over 9 years ago. Updated over 9 years ago.

Status:ApprovedStart date:12/26/2012
Priority:NormalDue date:
Assignee:Iñaki Zabala% Done:


Category:CoreEstimated time:1.00 hour
Target version:-Spent time:-


Hello Mirek

At home I have a Windows XP network. When I connect to it a Windows 7 computer, RealizeDirectory() fails.

The reason is that RealizeDirectory() gets all subpaths until the most basic one and calls DirectoryExists() and DirectoryCreate() for all of them.

Lets see a sample:

It is splitted into:

Then DirectoryExists("\\\\adomain") returns false and DirectoryCreate("\\\\adomain") returns false too, so RealizeDirectory("\\\\adomain\\adrive\\afolder") fails.

There are some ways to solve it. Perhaps the simplest one is changing the function:
bool RealizeDirectory(const String& d, int mode)
bool RealizeDirectory(const String& d)
#endif {
String dir = NormalizePath(d);
Vector<String> p;
while(dir.GetLength() > DIR_MIN && !DirectoryExists(dir)) { // Added "&& !DirectoryExists(dir)"
dir = GetFileFolder(dir);
for(int i = p.GetCount() - 1; i >= 0; i--)
//if(!DirectoryExists(p[i])) // Removed
#ifdef POSIX
if(!DirectoryCreate(p[i], mode))
return false;
return true;

This way, RealizeDirectory("\\\\adomain\\adrive\\afolder"), only tries to do DirectoryCreate() to "\\\\adomain\\adrive\\afolder" as adomain and adrive existed previously.


#1 Updated by Miroslav Fidler over 9 years ago

  • Status changed from New to Ready for QA
  • Assignee changed from Miroslav Fidler to Iñaki Zabala


#2 Updated by Iñaki Zabala over 9 years ago

  • Status changed from Ready for QA to Approved

Also available in: Atom PDF