Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-05-28 12:07:35


At 12:37 PM 5/28/2003, Stefan Seefeld wrote:
>hi there,
>
>I'm trying to load a plugin from the same directory the application was
>run from, so I'm doing the following:
>
>
>int main(int argc, char **argv)
>{
> //...
> fs::path path(argv[0]);
> fs::path dir(path.branch_path());
> //...
>
>
>but as soon as I start the application as './application', I get
>an exception telling me that ...
>
>boost::filesystem::path: invalid name "." in path: "./application"
>
>What am I missing ?

The "." isn't permitted in the generic grammar. There has been some thought
about adding it, but no decision yet. It is quite useful on systems which
do not automatically included the current directory in the search path.

But in the meantime, for user input, it is usual to allow native platform
specific paths, so change to:

   fs::path path(argv[0], fs::native );

HTH,

--Beman


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