Boost logo

Boost Users :

From: Roman Neuhauser (neuhauser_at_[hidden])
Date: 2006-08-19 07:45:05


# bobj_27_at_[hidden] / 2006-08-18 09:21:43 -0700:
> I ran across a problem in the convenience extension function. If the
> filename happens to have the the tilda character in it the function
> core drops. I discovered the problem when a file named ~trash was
> inadvertently created in a data directory. After creation of that
> file the system started core dropping. After much debugging I
> narrowed the problem to the extension function and the ~trash file.
>
> I was able to replicate the problem by
>
> std::string filename = "~test.txt";
> string ext = extension(filename);
>
> Does anyone know a work around or if there are any other gotcha
> characters in this function.

    From http://www.boost.org/libs/filesystem/doc/path.htm#synopsis

    : Class path member, or non-member operator/, functions may throw a
    : filesystem_error exception if the path is not in the syntax
    : specified for the grammar.

    : Note: There is no guarantee that a path object represents a path
    : which is considered valid by the current operating system. A path
    : might be invalid to the operating system because it contains invalid
    : names (too long, invalid characters, and so on), or because it is a
    : partial path still as yet unfinished by the program. An invalid path
    : will normally be detected at time of use, such as by one of the
    : Filesystem Library's operations or fstream functions.

    : Portability Warning: There is no guarantee that a path object
    : represents a path which would be portable to another operating
    : system. A path might be non-portable because it contains names which
    : the operating systems considers too long or contains invalid
    : characters. A default name_check mechanism is provided to aid in the
    : detection of non-portable names, or a name_check function can be
    : specified in path constructors. The library supplies several
    : name_check functions, or users can supply their own.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net