trouble with boost::filesystem::wrecursive_directory_iterator
- by Dogmatixed
I'm trying to write a program to help me manage my iTunes library, including removing duplicates and cataloging certain things. At this point I'm still just trying to get it to walk through all the folders, and have run into a problem: I have a small amount of Japanese music, where the artist and/or album is written in Japanese characters. Because of how iTunes arranges things in its library the directories contain these characters. "shouldn't be a problem, though." I thought, because the boost::filesystem library has a wide character version of its recursive iterator. but when I actually try to use it, it seems to completely stop when it hits the first Japanese char. complete stop as in it doesn't finish printing the line, no carriage return or anything.
now, I'm still pretty new to programming, so I'm assuming it's my mistake, anyone know why this is happening?
here's what I think is the relevant code:
fs::wrecursive_directory_iterator end_it;
int i;
try
{
for(fs::wrecursive_directory_iterator rec_it(full_path);
rec_it != end_it;
++rec_it)
{
for(i = 0; i < rec_it.level(); i++)
{
out << "\t";
}
out << rec_it->string() << std::endl;
}
}
catch(std::exception e)
{
out << "something went wrong: " << e.what();
}
and from my output file, minus some of the path:
/Test Libs/Combine
/Test Libs/Lib1
/Test Libs/Lib1/02 Too Long.m4a
/Test Libs/Lib1/03 Like a Hitman, Like a Dancer.mp3
/Test Libs/Lib1/A Certain Ratio
/Test Libs/Lib1/A Certain Ratio/Beyond Punk!
/Test Libs/Lib1/A Certain Ratio/Unknown Album
/Test Libs/Lib1/A Certain Ratio/Unknown Album/Do The Du.mp3
/Test Libs/Lib1/A Certain Ratio/Unknown Album/Shack Up.mp3
/Test Libs/Lib1/
finally, what I expect:
/Test Libs/Combine
/Test Libs/Lib1
/Test Libs/Lib1/02 Too Long.m4a
/Test Libs/Lib1/03 Like a Hitman, Like a Dancer.mp3
/Test Libs/Lib1/A Certain Ratio
/Test Libs/Lib1/A Certain Ratio/Beyond Punk!
/Test Libs/Lib1/A Certain Ratio/Unknown Album
/Test Libs/Lib1/A Certain Ratio/Unknown Album/Do The Du.mp3
/Test Libs/Lib1/A Certain Ratio/Unknown Album/Shack Up.mp3
/Test Libs/Lib1/???
/Test Libs/Lib1/Bring it on
/Test Libs/Lib1/04 Bring it on.mp3
any thoughts?
Thanks.