Boost logo

Boost :

Subject: Re: [boost] Boost.Process 0.5: Another update/potential candidate for an official library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-11-17 04:38:25


Le 17/11/12 01:04, Boris Schaeling a écrit :
> On Thu, 15 Nov 2012 18:59:11 +0100, Vicente J. Botet Escriba
> <vicente.botet_at_[hidden]> wrote:
>
>> [...]I guess that in this case the library should either allow only
>> absolute paths or transform the relative path on an absolute path so
>> that it is not subject to interpretations that depend on the platform.
>> Could this be possible?
>
> We could call boost::filesystem::absolute() to turn a relative path
> into an absolute one. I'm not sure where to put this call though. If
> it's put into start_in_dir to make an absolute path just before
> chdir() is called, it won't work with this code:
>
> execute(start_in_dir("bla"), run_exe("../foo"));
>
> Here start_in_dir is run before run_exe. So there is no path yet to
> turn into an absolute one. But if we put the call into run_exe, this
> could be surprising:
>
> run_exe r("../foo");
> chdir("bar");
> execute(r, start_in_dir("bla"));
>
> ../foo will be relative to whatever the current work directory was
> when run_exe was instantiated and not relative to bar. But then all
> those directory changes are confusing anyway. So maybe it makes most
> sense to call boost::filesystem::absolute() in the constructor of
> run_exe?
>
>

Maybe 'execute' could take care of the normalization :)

Best,
Vicente


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