Opened 19 years ago

Closed 17 years ago

#228 closed Bugs (Fixed)

Boost::Filesystem fails when last character in path is ':'

Reported by: nobody Owned by: beman_dawes
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

Boost::filesystem library fails when the last character in 
a directory name is ':'

Example path '/my/test/path/is/c:'

This isn´t valid on windows, but on ReiserFS this is a 
valid directory path.

The bug is located in path::m_path_append(...)
(path_posix_windows.cpp) where the follwing code try 
to append '/' if neccesary

=======

// append '/' if needed
if ( !empty()
      && *(m_path.end()-1) != ':' 
      && *(m_path.end()-1) != '/' )
              m_path += '/';

=======

If I want to append myFile.txt to the path with the 
existing code the result will be: 
'/my/test/path/is/c:myFile.txt'  => ERROR

My suggestion is to replace this section with

=======

// append '/' if needed
if ( !empty()
#ifdef BOOST_WINDOWS
      && *(m_path.end()-1) != ':' 
#endif
      && *(m_path.end()-1) != '/' )
              m_path += '/';

=======

e-mail: tommy.edvardsen@ibas.no

Change History (1)

comment:1 by beman_dawes, 17 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.