Create directories if they are missing

This commit is contained in:
Learath2 2015-08-29 23:40:10 +03:00
parent d08bd06610
commit 8504dbc058

View file

@ -102,6 +102,18 @@ void CFetcher::FetchFile(CFetchTask *pTask)
m_pStorage->GetBinaryPath(pTask->m_aDest, aPath, sizeof(aPath)); m_pStorage->GetBinaryPath(pTask->m_aDest, aPath, sizeof(aPath));
else else
m_pStorage->GetCompletePath(pTask->m_StorageType, pTask->m_aDest, aPath, sizeof(aPath)); m_pStorage->GetCompletePath(pTask->m_StorageType, pTask->m_aDest, aPath, sizeof(aPath));
for(char *p = aPath; *p != '\0'; p++)
{
if(*p == '/' && *(p + 1) != '\0')
{
*p = '\0';
if(fs_makedir(aPath) < 0)
dbg_msg("fetcher", "I/O Error couldnt create folder: %s", aPath);
*p = '/';
}
}
IOHANDLE File = io_open(aPath, IOFLAG_WRITE); IOHANDLE File = io_open(aPath, IOFLAG_WRITE);
if(!File){ if(!File){