mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Create directories if they are missing
This commit is contained in:
parent
d08bd06610
commit
8504dbc058
|
@ -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){
|
||||||
|
|
Loading…
Reference in a new issue