-----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-----
On 3/17/07, Tom Bachmann
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 me22 schrieb:
[...]
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).
Ok, thanks for that clarification. - -- - -ness- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFF/CYKvD/ijq9JWhsRAmqZAJ0aBsjeUBzAemgOuLmulp9n+Zh9SwCggUkP MLaOf9sFr1nrLnsx5SYPOMo= =aWm3 -----END PGP SIGNATURE-----
participants (2)
-
me22
-
Tom Bachmann