Beman Dawes wrote:
At 12:57 PM 12/11/2003, Scott Meyers wrote:
On Thu, 11 Dec 2003 08:32:06 +0100, Galante Michele wrote:
int processFile(const fs::path& fileName) { fs::path copyFileName(fileName.string() + ".bak"); fs::copy_file(fileName, copyFileName); }
I had tried this before. It also throws.
It would have to be:
int processFile(const fs::path& fileName) { fs::path copyFileName(fileName.string() + ".bak", fs::native); fs::copy_file(fileName, copyFileName); }
I don't see why. string() returns a path "formatted according to the rules of the generic path string grammar", i.e. '/' separator. Aren't native paths allowed to use a ':' separator with '/' being a legitimate part of the name, for instance? Why does the original fs::path copyFileName(fileName.string() + ".bak"); throw? I see nothing that could cause fileName.string() + ".bak" to fail validation. Am I missing something, or is this a bug?