|
Boost Users : |
From: me22 (me22.ca_at_[hidden])
Date: 2007-03-17 13:21:21
On 3/17/07, Tom Bachmann <e_mc_h2_at_[hidden]> wrote:
> Is the following code expected to be portable?
>
> namespace fs = boost::filesystem;
> fs::rename (current_p, skin_p / current_p.leaf ());
>
Only if the paths pass the name checker, as you've found out.
> boost::filesystem::path: invalid name
> "10NfRaHD1AAICPMKZIC50FvmaHw==.medium.jpg" in path:
> "10NfRaHD1AAICPMKZIC50FvmaHw==.medium.jpg"
>
> (that is, I believe, at the point where a temporary path object is
> constructed from current_p.leaf ()). This appears quiet strange to me,
> as I never mention the file in the code, and I'd expect the library to
> treat such oddities.
>
The library does not track the source of paths.
> The following code works:
>
> fs::rename (current_p, skin_p / fs::path (current_p.leaf (),
> fs::native));
>
> Is this the expected behavior?
>
Yes.
Note that in 1.34, the obligatory path checking has been removed, so
the original code will work as expected. In the mean time, you may
wish to set the default path checker to native (or none).
~ Scott McMurray
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