Thanks nvtkrishna!
It is great!
I have made some changes (see bold text), because my builder do not compiled it.
But the point is Yours!
You think this is okay?
Regards,
Bejglee
void CreateDirectoryWithChecking(const wchar_t* i_LPCWSTR_FolderPath)
{
::WIN32_FIND_DATAW data;
::HANDLE handle = ::FindFirstFileW(i_LPCWSTR_FolderPath, &data);
if (handle == INVALID_HANDLE_VALUE)
::CreateDirectoryW(i_LPCWSTR_FolderPath, NULL);
else
FindClose(handle);
}
bool createFolderStrecture(const wchar_t* _folderName)
{
if (!_folderName)return false;
size_t len = 0;
while (_folderName[len] != '\0') ++len;
for (size_t index = 0; index < len; index++)
{
if (_folderName[index] == L'\\' && index > 3)
{
wchar_t curFolderPath[_MAX_PATH];
SecureZeroMemory(curFolderPath, _MAX_PATH * sizeof(wchar_t));
::wmemcpy_s(curFolderPath, _MAX_PATH*sizeof(wchar_t), _folderName, (index)*sizeof(wchar_t));
CreateDirectoryWithChecking(curFolderPath);
}
}
return true;
}