login about faq


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!

asked Oct 17 at 03:55

Hennyere's gravatar image


edited Oct 17 at 03:56

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.


answered Oct 20 at 16:56

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 17 at 03:55

Seen: 971 times

Last updated: Oct 20 at 16:56

powered by OSQA