Module: wine Branch: master Commit: edda4637b449cd17a7c091cac867d1e5a6896f2a URL: http://source.winehq.org/git/wine.git/?a=commit;h=edda4637b449cd17a7c091cac8...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Dec 29 14:50:26 2008 +0100
cabinet: Make sure that parent directories exist when creating a new directory.
---
dlls/cabinet/cabinet_main.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/dlls/cabinet/cabinet_main.c b/dlls/cabinet/cabinet_main.c index 35810e3..4748a99 100644 --- a/dlls/cabinet/cabinet_main.c +++ b/dlls/cabinet/cabinet_main.c @@ -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);