// Verifyes or creates Path
//
static client public boolean createDirectoryPath()
{
int ptr;
FilePath _path = xinfo::directory(directorytype::Bin) + '\Image';
;
_path = strLRTrim(_path);
if (substr(_path,strlen(_path),1) != '\\') // Adding backslash gives a more simple while-loop!
{
_path += '\\';
}
//MKU: enables creation of UNC paths, by detecting which folder already exists (backwards).
ptr = strLen(_path);
ptr = strfind(_path, '\\', ptr, -ptr);
while(!WinAPI::folderExists(substr(_path,1,ptr)))
{
ptr = strfind(_path, '\\', ptr -1 , -ptr);
}
// ptr now points to last existing folder in the path.
//MKU: end
while (ptr)
{
WinAPI::createDirectory(substr(_path, 1, ptr));
if (!WinAPI::folderExists(substr(_path, 1, ptr)))
{
break;
}
ptr = strfind(_path, '\\', ptr + 1, strlen(_path));
}
return WinAPI::folderExists(_path);
}
Hi, it works for UNC path also.
Thanks,
/Ashlesh
No comments:
Post a Comment