EldoS | Feel safer!

Software components for data protection, secure storage and transfer


Posted: 01/07/2015 03:46:33
by Birger Jansen (Standard support level)
Joined: 07/19/2012
Posts: 80

I ran into a problem:

The function SBUtils.DirectoryExists has the same name and parameters as System.SysUtils.DirectoryExists. The SysUtils version works with UNC paths (\\server\folder) and the SBUtils does not.

For a careless developer like me it was not clear which version is used :-) (depends on the order of the units in the uses clause).

To prevent future problems, can you consider making SBUtils.DirectoryExists also be aware of UNC paths, or maybe just use System.SysUtils.DirectoryExists?
Posted: 01/07/2015 04:00:52
by Eugene Mayevski (Team)

The problem is that SysUtils' implementation of DirectoryExists is also not free of bugs (eg. see here: http://stackoverflow.com/questions/15...pped-units , but there are more different reports available ). So our implementation should exist as well. You can use the SysUtils' version by calling SysUtils.DirectoryExists() method.

What exactly doesn't work for you in regards to UNC paths? Do you get a false positive or false negative result or some error happens?

Sincerely yours
Eugene Mayevski
Posted: 01/07/2015 07:02:43
by Birger Jansen (Standard support level)
Joined: 07/19/2012
Posts: 80

For a directory \\server\folder that does exist I get:

SBUtils.DirectoryExists('\\server\folder') = false

System.SysUtils.DirectoryExists('\\server\folder') = true

But SBUtils.DirectoryExists('\\server\folder\subfolder') = true

According to http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx the used FindFirst in SBUtils.DirectoryExists needs special attention when searching on the root of a network share!
Posted: 01/07/2015 07:12:10
by Eugene Mayevski (Team)

Thank you very much for detailed explanation. We will improve our implementation.

Sincerely yours
Eugene Mayevski



Topic viewed 786 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!