createDirectory crashes on non existant drive


#1

createDirectory(T(“g:\temp”)); will crash if there is no g drive.

It goes into an endless recursive loop and eventually blows up the stack.

This will fix it on the pc. I’m not sure if something similar can happen on linux or the mac.

[code]bool File::createDirectory() const throw()
{
if (! isDirectory())
{
File parent = getParentDirectory();
if (parent == *this || !parent.createDirectory())
return false;

    String dir (fullPath);

    while (dir.endsWithChar (separator))
        dir [dir.length() - 1] = 0;

    juce_createDirectory (dir);

    return isDirectory();
}

return true;

}[/code]


#2

Ah - thanks for spotting that. Looks like the same fix should also go into File::create() too.


#3