Boost logo

Boost Users :

From: anthony giardullo (anthonyj_at_[hidden])
Date: 2008-08-26 20:03:48


On Tue, Aug 26, 2008 at 4:54 PM, anthony giardullo <anthonyj_at_[hidden]> wrote:
> Scott McMurray wrote:
>> On Fri, Aug 15, 2008 at 12:57, Scott Finley <sfinley_at_[hidden]> wrote:
>>> bfs_test.cpp: In function 'int main()':
>>>
>>> bfs_test.cpp:13: error: 'class
>>> boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<char,
>>> std::char_traits<char>, std::allocator<char> >,
>>> boost::filesystem::path_traits> >' has no member named 'leaf'
>>>
>>> My mistake, or did something change/break?
>>>
>>
>> It looks like you now need
>> itr->path().leaf()
>> or
>> boost::implicit_cast<bfs::path const &>(*itr).leaf()
>> ( http://beta.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Class-template-basic_directory_entry
>> )
>>
>> As I recall, this change was part of optimization efforts to make
>> iterating faster by caching the file_status.
>>
>> Also, it was decided that some of the names for path decomposition
>> functions were confusing, particularly branch and leaf, so they were
>> changed. The new path decomposition table suggests that you should
>> now be using filename() instead of leaf():
>> http://beta.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Path-decomposition-table
>> (But it's likely backwards-compatible, so you shouldn't need to.)
>
> Yes, that's the theory. But it looks like 1.36.0 inadvertently renamed
> basic_directory_entry::leaf without providing backward compatibility.
>
> I'll try to post a hotfix for that. Since basic_directory_entry::leaf is
> deprecated anyhow, my initial reaction is that it should have been left
> alone.
>
> --Beman
>

I would also appreciate a hotfix for this as this change is breaking a
project that I am hoping to release soon.

Is there an alternative solution I can use that will work in both 1.36
and earlier versions? I tried both filename() and path().leaf, but
these do not work in 1.33.

Thanks,
Anthony


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