Boost logo

Boost Users :

From: Scott Meyers (Usenet_at_[hidden])
Date: 2003-12-11 01:11:04


I'm trying to use copy_file to, well, copy a file to a backup file
(signified by adding ".bak" to the file's name). Here's what I'm doing,
chopped way down:

  int processFile(const fs::path& fileName)
  {
      fs::path copyFileName(fileName.native_file_string() + ".bak");
      fs::copy_file(fileName, copyFileName);
  }

This throws an exception:

  boost::filesystem::path: invalid name "D:\Temp\CDFix\INDEX.HTM.bak" in path: "D:\Temp\CDFix
\INDEX.HTM.bak"

I don't see what's invalid about this name. From what I can tell, I'm
fulfilling copy_file's preconditions and not falling into one of the cases
where it's supposed to throw.

What am I doing wrong?

Thanks,

Scott


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