Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-02-07 18:55:18


"SourceForge.net" <noreply_at_[hidden]> wrote in message
news:E1Ew5Qo-0004bc-Ub_at_sc8-sf-web2.sourceforge.net...
> Patches item #1157160, was opened at 2005-03-04 23:23
> Message generated for change (Settings changed) made by mclow
> You can respond by visiting:
> https://sourceforge.net/tracker/?func=detail&atid=307586&aid=1157160&group_id=7586
>
> Please note that this message will contain a full copy of the comment
> thread,
> including the initial issue submission, for this request,
> not just the latest update.
> Category: None
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Submitted By: Steven Weiss (fotzor)
>>Assigned to: Beman Dawes (beman_dawes)
> Summary: patch for boost::filesystem
>
> Initial Comment:
> hi,
> when you try to get the branch path of this
> "c:\\some_dir\\some_file.txt"
> under windows the branch path should be "c:\\some_dir".
> what is returned instead is "c:" which isn't correct.
> so here's the fix:
>
> in path_posix_windows.cpp:
>
> std::string::size_type leaf_pos( const std::string & str,
> std::string::size_type end_pos ) // end_pos is
> past-the-end position
> // return 0 if str itself is leaf (or empty)
> {
> if ( end_pos && str[end_pos-1] == '/' ) return
> end_pos-1;
>
> std::string::size_type pos( str.find_last_of( '/',
> end_pos-1 ) );
> # ifdef BOOST_WINDOWS
> if ( pos == std::string::npos ) pos =
> str.find_last_of( '\\', end_pos-1 ); //
> ADDED
> if ( pos == std::string::npos ) pos =
> str.find_last_of( ':', end_pos-2 );
> # endif
>
> return ( pos == std::string::npos // path itself
> must be a leaf (or empty)
> # ifdef BOOST_WINDOWS
> || (pos == 1 && (str[0] == '/' || str[0] ==
> '\\')) // or share // ADDED
> # endif
> ) ? 0 // so leaf is entire string
> : pos + 1; // or starts after delimiter
> }
>
>
> mfg steven
>
> ----------------------------------------------------------------------
>
> Comment By: Steven Weiss (fotzor)
> Date: 2005-03-05 00:24
>
> Message:
> Logged In: YES
> user_id=1124235
>
> i forgot something...
> in branch_path() you must also change the condition of the
> if to:
>
> if ( end_pos && (m_path[end_pos-1] == '/' ||
> m_path[end_pos-1] == '\\')
> && !detail::is_absolute_root( m_path, end_pos ) )
> --end_pos;
>
> else it doesn't work proper. perhaps there are other
> functions depending on leaf_pos() that must be adjusted as well

I've closed this without applying the patch. A path regression test case was
added. It passes.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk