cabinet: Make sure that parent directories exist when creating a new directory.

This commit is contained in:
Jacek Caban 2008-12-29 14:50:26 +01:00 committed by Alexandre Julliard
parent 6b955b514d
commit edda4637b4
1 changed files with 11 additions and 0 deletions

View File

@ -237,7 +237,18 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf
/* create the destination directory if it doesn't exist */
if (GetFileAttributesA(szDirectory) == INVALID_FILE_ATTRIBUTES)
{
char *ptr;
for(ptr = szDirectory + strlen(pDestination->Destination)+1; *ptr; ptr++) {
if(*ptr == '\\') {
*ptr = 0;
CreateDirectoryA(szDirectory, NULL);
*ptr = '\\';
}
}
CreateDirectoryA(szDirectory, NULL);
}
hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);