Directory.Exists() Issue


On Windows CE 4.X based devices, Directory.Exists() treats path names ending with a slash "\" differently. As an example,

Directory.Exists("\\temp")

will return true if the "temp" directory exists. However, the following call will return false even though the directory exists:

Directory.Exists("\\temp\\")

On Windows Mobile 5.0 devices, NETCF's behavior is consistent with Desktop's; that is, Directory.Exists() returns true if and only if the directory exists, no matter whether there is a trailing slash in the path or not. For the above example, we will return true for both calls if the directory exists.

Cheers,

Anthony Wong [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights.

Comments (0)

Skip to main content