Boost logo

Boost :

From: Martin (adrianm_at_[hidden])
Date: 2004-09-28 06:43:43


If I write *.txt in a windows file selection dialog box, I will see all files
in the directory ending with ".txt" (in lowercase) but also all files ending
in ".TXT", ".tXt" etc that doesn't have the FILE_FLAG_POSIX_SEMANTICS
attribute set.

I get the same result by using "*.txt" with the win32 native functions
FindFirstFile/FindNextFile.

It is normally not a problem but when trying to write portable code it is not
clear if I should write "*.txt" or "*.[tT][xX][tT]". Both might give non-
expected results.

The best thing would be if the glob function treated case sensitivity in the
same way as the underlying filsystem but then it would have to be part of the
filesystem library.

Another thing:
The boost.filesystem function is_directory might throw for security reasons on
files in a directory. I recommend that you create your own non-throwing
overload

bool is_directory(const path& aPath, bool aErrorRet) {
  try { return is_directory(aPath); } catch (...) { return aErrorRet; }
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk