|
Boost Users : |
From: Chris 'Xenon' Hanson (xenon_at_[hidden])
Date: 2005-06-28 15:45:18
I'm using Boost.Filesystem (along with Boost.Regex, and an unofficial glob library by
Angus Leeming) to do globbing and batch file processing in a utility of mine. Environment
is boost_1_32_0, Windows XP, MSVC++7.1. The Glob/Regex stuff seems fine -- I fill a
vector<string> container with the results and then pass it off to another piece of code to
actually do the work.
Part of the work involves printing the filename (without path, but with extension).
Here's a snippet:
int ProcessFile(ofstream &Out, const char *FullPathName)
{
int Success = 0;
fs::path OutFilePath(FullPathName, fs::native);
std::string JustName, NameNoExt;
JustName = fs::basename(OutFilePath.leaf()) + fs::extension(OutFilePath.leaf());
NameNoExt = fs::basename(OutFilePath.leaf());
PrintItem(Out, FullPathName, JustName.c_str(), NameNoExt.c_str());
return(Success);
} // ProcessFile
Ignore that it's poor code quality -- this is just a quick & dirty hack program.
Everything works great until this code is fed a FullPathName of:
eggs+butter01d-thumbs.jpg
(In this example, I'm running with relative paths, so there is no "path" part to
discard. Makes troubleshooting even simpler.)
It throws an exception of
boost::filesystem::path invalid name eggs+butter01d-thumbs.jpg in path
eggs+butter01d-thumbs.jpg
on line 341 of path_posix_windows.cpp
It appears to displike the + character.
Maybe it's pilot error, but + is apparently a valid symbol in the Win32/NTFS
filesystem, and Windows permits it, generally. If it were a weird platform-specific
symbol, I would have thought that creating the fs::path with
fs::path OutFilePath(FullPathName, fs::native);
would have translated it into somethign boost-friendly.
Anyone care to tell me what I'm doing wrong? Thanks in advance for any advice.
-- Chris 'Xenon' Hanson | Xenon @ 3D Nature | http://www.3DNature.com/ "I set the wheels in motion, turn up all the machines, activate the programs, and run behind the scenes. I set the clouds in motion, turn up light and sound, activate the window, and watch the world go 'round." -Prime Mover, Rush.
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