Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case sensitive Directory.Exists / File.Exists

Is there a way to have a case sensitive Directory.Exists / File.Existssince

Directory.Exists(folderPath)

and

Directory.Exists(folderPath.ToLower())

both return true?

Most of the time it doesn't matter but I'm using a macro which seems not to work if the path doesn't match cases 100%.

like image 576
theknut Avatar asked Apr 24 '13 05:04

theknut


1 Answers

Since Directory.Exists uses FindFirstFile which is not case-sensitive, no. But you can PInvoke FindFirstFileEx with an additionalFlags parameter set to FIND_FIRST_EX_CASE_SENSITIVE

like image 151
Jacob Seleznev Avatar answered Sep 17 '22 13:09

Jacob Seleznev