File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -136,10 +136,8 @@ std::string concat_dir_file(
136136  const  std::string &file_name)
137137{
138138  #ifdef  _WIN32
139-   return   (file_name.size ()>1  &&
140-            file_name[0 ]!=' /'   &&
141-            file_name[1 ]!=' :'  ) ?
142-            file_name : directory+" \\ "  +file_name;
139+   return  (file_name.size () > 1  && file_name[0 ] != ' /'   && file_name[1 ] == ' :'  ) ?
140+           file_name : directory + " \\ "   + file_name;
143141  #else 
144142  return  (!file_name.empty () && file_name[0 ]==' /'  ) ?
145143          file_name : directory+" /"  +file_name;
Original file line number Diff line number Diff line change @@ -14,6 +14,27 @@ Author: Daniel Kroening
1414
1515#include  < fstream> 
1616
17+ TEST_CASE (" concat_dir_file functionality"  , " [core][util][file_util]"  )
18+ {
19+   temp_dirt temp_dir (" testXXXXXX"  );
20+   const  std::string path = concat_dir_file (temp_dir.path , " bla.txt"  );
21+ 
22+   REQUIRE (path.size () > temp_dir.path .size () + std::string (" bla.txt"  ).size ());
23+   #ifdef  _WIN32
24+   REQUIRE (path.find (' \\ '  ) != std::string::npos);
25+   #else 
26+   REQUIRE (path.find (' /'  ) != std::string::npos);
27+   #endif 
28+ 
29+   #ifdef  _WIN32
30+   const  std::string qualified_path = " z:\some\path\f oo.txt"  ;
31+   #else 
32+   const  std::string qualified_path = " /some/path/foo.txt"  ;
33+   #endif 
34+   const  std::string path2 = concat_dir_file (temp_dir.path , qualified_path);
35+   REQUIRE (path2 == qualified_path);
36+ }
37+ 
1738TEST_CASE (" is_directory functionality"  , " [core][util][file_util]"  )
1839{
1940  temp_dirt temp_dir (" testXXXXXX"  );
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments