Georg Baum wrote: > You probably tried the char version. This one needs always a replacement > char, but with the const char * version you can also use "" as replacement.
Yes, probably. > OK, I did not notice that. What about the attached version? This is your > original one, with the missing test added. Looks good (also the erase part; I just didn't think of that). > > It is needed. We need to strip of the string, else it is getting endless. > > Ah, so the 255 was both for windows max path and because the string must > not grow endlessly. In that case I would prefer a suitable name for this > constant. MAX_PATH or PATH_MAX are misleading, since it implies that the > length is limited by an OS constant, but was is really used here is a more > or less arbitrary length limit rfor parsing purposes. The idea is the following: if the string exceeds MAX_PATH, then we know for sure that it is not the _part_ of a filename where we have to look further in the next lines, so we can cut off (it still can contain the part of a file name, but the chunk we are cutting cannot be part of that). Furthermore, we avoid a boost exception, because boost::fs obviously also checks for the length and compares with MAX_PATH. Ideally, this should indeed be bound to the OS, since on Linux (and some Windows variants IIRC) the path can very well be longer than 255 chars, and boost::fs should not throw in such cases (and it doesn't on Linux indeed). > Georg Jürgen