SalFileCreateDirectory issue with UNC paths

Report bugs and possible workarounds for ANSI TD versions
Posts: 265
Joined: 06 Mar 2017, 22:41
Location: Mackay QLD Australia

SalFileCreateDirectory issue with UNC paths

Post by TerryP » 04 Sep 2014, 23:46

Hi All,

I noticed this in 4.1, but it happens in 6.2 ( as well, so I expect it happens in all versions. With the introduction of Windows 8, many clients (for some reason) are requiring UNC paths to be used in many situations, which generally seem to work fine with TD functions in all versions. However, I've found an issue with SalFileCreateDirectory function which has a problem with UNC paths that doesn't happen when you use a normal drive-mapped path.

SalFileCreateDirectory on a drive-mapped path will create multiple missing folders to establish the full path. However, for a UNC path, it will only successfully create the last folder in the specified path, it won't create multiple missing folders.

For example, for the path "c:\temp\test\multi\folder\path", SalFileCreateDirectory will create each of the required nested folders in a single call to the function.
For the equivalent path "\\mypc\c$\temp\test\multi\folder\path", SalFileCreateDirectory will only create the last missing folder ("path") when the preceding path, "\\mypc\c$\temp\test\multi\folder", already exists.
Test Create
Attached is a simple TD 6.2 application that can be used to demonstrate the problem. When you press "Old Create" the specified Path is created and the Directory List box populated to show the resultant path. If the path isn't created, the Directory List box population doesn't show anything. You can then change the Path to whatever you want to test, eg. a similar UNC path, and press "Old Create" again.

Of course, it's fairly simple to write a funtion that will work around this limitation, just tokenize the path into separate folders and create the path one level at a time. In the example application, I've defined the function SalFileCreatePath( sPath ), invoked by the "New Create" button, which successfully creates full paths with either drive-mapped or UNC formats.

However, the SalFileCreateDirectory limitation should either be addressed, or at least documented in the online help and reference manuals.

You do not have the required permissions to view the files attached to this post.
Terry Phythian
Reprise Consulting

Return to “Bug Reports (TD 4.2 and older)”

Who is online

Users browsing this forum: [Ccbot] and 0 guests