Boost logo

Boost Users :

From: Tom Bachmann (e_mc_h2_at_[hidden])
Date: 2007-03-17 10:31:43


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Is the following code expected to be portable?

namespace fs = boost::filesystem;
fs::rename (current_p, skin_p / current_p.leaf ());

Where current_p and skin_p are fs::path, where current_p is valid and
skin_p is the result of dereferencing a directory iterator (that was not
at behind-end position at time of dereferencing).

For current_p = foo/10NfRaHD1AAICPMKZIC50FvmaHw==.medium.jpg
    skin_p = foo/bar (directory)
the code causes an exception:

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 following code works:

fs::rename (current_p, skin_p / fs::path (current_p.leaf (),
                                              fs::native));

Is this the expected behavior?
- --
- -ness-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF+/vPvD/ijq9JWhsRAhMdAKCDyLsi0EKzhUnVcM3GjKopqnpcCQCbBK4y
vkNablkmw69y3xj6ulSNdvs=
=izVN
-----END PGP SIGNATURE-----


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