I found a bug on CkFileAccess ActiveX
Dim X As CkFileAccess, L as Long Set X = New CkFileAccess L = X.DirAutoCreate(xPath) Set X = Nothing
DirAutoCreate Returns 1 For "C:\Users\XXX\AppData\Local\Temp\TMPFOLDER" but Directory was not created DirAutoCreate Returns 1 For "C:\Users\XXX\AppData\Local\Temp\TMPFOLDER\" and Directory was created!
If Right Char is "\" The function works but if the right char is not "\" the function do not works!
Thanks, but you didn't actually find a bug. :)
There are two CkFileAccess methods for auto-creating directories: DirAutoCreate and DirEnsureExists.
You pass a filePath to DirAutoCreate. A filePath is a path where the last part is a filename. For example: C:\Users\XXX\AppData\something.txt
Filenames don't need to have extensions, so when you pass C:\Users\XXX\AppData\Local\Temp\TMPFOLDER to DirAutoCreate, it interprets it as a filePath, where TMPFOLDER is a filename and the rest is a directory path. The purpose of DirAutoCreate is to create the necessary directories for the filename specified in the filePath.
On the other hand, you pass a directory path to DirEnsureExists. This method assumes you only have directories in the path (it is not a filePath). If you pass C:\Users\XXX\AppData\Local\Temp\TMPFOLDER to DirEnsureExists, you'll get the behavior you wanted.