Boost logo

Boost Users :

Subject: [Boost-users] [filesystem] v3 recursive_directory_iterator does not enumerate entries
From: Timothy Madden (terminatorul_at_[hidden])
Date: 2010-09-03 07:00:14


Hello

I use recursive_directory_iterator in my project and the dereference
operarator on the iterator object always returns the the base directory
that I am iterating over, and not the directory entries, each one in turn.

Am I doing something wrong ?

            int iLevel = -1;

            // loop over and copy each file from the source directory
            for
                (
                    recursive_directory_iterator
                        it(tmpName);
                    it != recursive_directory_iterator();
                    it++
                )
            {
                //if (it.level() != iLevel)
                if (true)
                {
                    // recursion just entered a new directory, create it
#ifdef _DEBUG
                    boost::filesystem::path
                        dir_entry(*it);

                    cout << "Entry: " << dir_entry << endl;
                    cout << "\tas:";
                    for
                        (
                            boost::filesystem::path::iterator
                                p_it = dir_entry.begin();
                            p_it != dir_entry.end();
                            p_it++
                        )
                    {
                        if (p_it != dir_entry.begin())
                            cout << "/";
                        cout << *p_it;
                    }
                    cout << endl;
#endif
                    iLevel = it.level();
                }
            }

Thank you,
Timothy Madden


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